Skip to content
This repository was archived by the owner on May 20, 2019. It is now read-only.

[Backport] Fix HTTP Delete for Async operations #31

Merged
merged 2 commits into from
Oct 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ public function __construct(

/**
* Process and resolve input parameters
*
* Return array with validated input params
* or throw \Exception if at least one request entity params is not valid
*
* @return array
* @throws \Magento\Framework\Exception\InputException if no value is provided for required parameters
* @throws \Magento\Framework\Webapi\Exception
* @throws \Magento\Framework\Exception\AuthorizationException
*/
public function resolve()
{
Expand All @@ -95,6 +97,13 @@ public function resolve()
$this->requestValidator->validate();
$webapiResolvedParams = [];
$inputData = $this->request->getRequestData();

$httpMethod = $this->request->getHttpMethod();
if ($httpMethod == \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE) {
$requestBodyParams = $this->request->getBodyParams();
$inputData = array_merge($requestBodyParams, $inputData);
}

foreach ($inputData as $key => $singleEntityParams) {
$webapiResolvedParams[$key] = $this->resolveBulkItemParams($singleEntityParams);
}
Expand All @@ -103,6 +112,8 @@ public function resolve()
}

/**
* Detect route by input parameters
*
* @return \Magento\Webapi\Controller\Rest\Router\Route
*/
public function getRoute()
Expand All @@ -111,9 +122,10 @@ public function getRoute()
}

/**
* Resolve parameters for service
*
* Convert the input array from key-value format to a list of parameters
* suitable for the specified class / method.
*
* Instead of \Magento\Webapi\Controller\Rest\InputParamsResolver
* we don't need to merge body params with url params and use only body params
*
Expand Down