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

Commit be01630

Browse files
committed
magento-engcom/bulk-api#4 Support for Async operations in WebAPI
- fixed static tests
1 parent 925b018 commit be01630

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

app/code/Magento/WebapiAsync/Controller/Rest/AsynchronousRequestProcessor.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class AsynchronousRequestProcessor implements RequestProcessorInterface
1818
{
19-
const PROCESSOR_PATH = 'async/V1';
19+
const PROCESSOR_PATH = "/async/V\\d+/";
2020

2121
/**
2222
* @var \Magento\Framework\Webapi\Rest\Response
@@ -58,7 +58,8 @@ public function __construct(
5858
MassSchedule $asyncBulkPublisher,
5959
WebApiAsyncConfig $webapiAsyncConfig,
6060
DataObjectProcessor $dataObjectProcessor
61-
) {
61+
)
62+
{
6263
$this->response = $response;
6364
$this->inputParamsResolver = $inputParamsResolver;
6465
$this->asyncBulkPublisher = $asyncBulkPublisher;
@@ -95,20 +96,12 @@ public function process(\Magento\Framework\Webapi\Rest\Request $request)
9596
);
9697

9798
$this->response->setStatusCode(RestResponse::STATUS_CODE_202)
98-
->prepareResponse($responseData);
99+
->prepareResponse($responseData);
99100
} catch (\Exception $e) {
100101
$this->response->setException($e);
101102
}
102103
}
103104

104-
/**
105-
* {@inheritdoc}
106-
*/
107-
public function getProcessorPath()
108-
{
109-
return self::PROCESSOR_PATH;
110-
}
111-
112105
/**
113106
* @param \Magento\Framework\Webapi\Rest\Request $request
114107
* @return string
@@ -126,8 +119,9 @@ private function getTopicName($request)
126119
/**
127120
* {@inheritdoc}
128121
*/
129-
public function canProcess(\Magento\Framework\Webapi\Rest\Request $request) {
130-
if (strpos(ltrim($request->getPathInfo(), '/'), $this->getProcessorPath()) === 0) {
122+
public function canProcess(\Magento\Framework\Webapi\Rest\Request $request)
123+
{
124+
if (preg_match(self::PROCESSOR_PATH, ltrim($request->getPathInfo(), '/')) === 0) {
131125
return true;
132126
}
133127
return false;

0 commit comments

Comments
 (0)