/**
  * Process and resolve input parameters
  *
  * @return array
  * @throws \Magento\Framework\Webapi\Exception
  */
 public function resolve()
 {
     $this->requestValidator->validate();
     $route = $this->getRoute();
     $serviceMethodName = $route->getServiceMethod();
     $serviceClassName = $route->getServiceClass();
     /*
      * Valid only for updates using PUT when passing id value both in URL and body
      */
     if ($this->request->getHttpMethod() == RestRequest::HTTP_METHOD_PUT) {
         $inputData = $this->paramsOverrider->overrideRequestBodyIdWithPathParam($this->request->getParams(), $this->request->getBodyParams(), $serviceClassName, $serviceMethodName);
         $inputData = array_merge($inputData, $this->request->getParams());
     } else {
         $inputData = $this->request->getRequestData();
     }
     $inputData = $this->paramsOverrider->override($inputData, $route->getParameters());
     $inputParams = $this->serviceInputProcessor->process($serviceClassName, $serviceMethodName, $inputData);
     return $inputParams;
 }
Example #2
0
 /**
  * Test for getBodyParams() method.
  */
 public function testGetBodyParams()
 {
     $params = ['a' => 123, 'b' => 145];
     $this->_prepareSutForGetBodyParamsTest($params);
     $this->assertEquals($params, $this->_request->getBodyParams(), 'Body parameters were retrieved incorrectly.');
 }