From 069aa1c014ef872ba5b353fa08a2359e66cbe630 Mon Sep 17 00:00:00 2001 From: "Vasiliev.A" Date: Mon, 17 Sep 2018 14:30:40 +0300 Subject: [PATCH 1/2] add support HTTP DELETE method for async bulk request by adding merging url params with body params --- .../Controller/Rest/Asynchronous/InputParamsResolver.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php b/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php index e6df38c563e..4ebb23f33e9 100644 --- a/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php +++ b/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php @@ -95,6 +95,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); } From 694d2191c74b3ecba27748c11380ee6a70cd3117 Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Wed, 3 Oct 2018 12:47:18 +0300 Subject: [PATCH 2/2] Fix doc block style --- .../Controller/Rest/Asynchronous/InputParamsResolver.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php b/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php index 4ebb23f33e9..cb72189f6d5 100644 --- a/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php +++ b/app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php @@ -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() { @@ -110,6 +112,8 @@ public function resolve() } /** + * Detect route by input parameters + * * @return \Magento\Webapi\Controller\Rest\Router\Route */ public function getRoute() @@ -118,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 *