Skip to content

Commit 4eb2cc7

Browse files
committed
AC-465: Allow to configure input limit for RESTful endpoints
1 parent 4d9988e commit 4eb2cc7

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

app/code/Magento/Webapi/Controller/Rest/InputParamsResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ private function validateParameters(
184184
}
185185
}
186186
if (!empty($paramOverriders)) {
187-
throw new \UnexpectedValueException(
188-
__('The current request does not expect the next parameters: ' . implode(', ', $paramOverriders))
189-
);
187+
$message = 'The current request does not expect the next parameters: '
188+
. implode(', ', $paramOverriders);
189+
throw new \UnexpectedValueException(__($message)->__toString());
190190
}
191191
}
192192
}

dev/tests/api-functional/framework/Magento/TestFramework/TestCase/WebapiAbstract.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ protected function _restoreAppConfig()
566566
public function processRestExceptionResult(\Exception $e)
567567
{
568568
$error = json_decode($e->getMessage(), true);
569+
if(json_last_error() !== JSON_ERROR_NONE) {
570+
$error['message'] = $e->getMessage();
571+
}
569572
//Remove line breaks and replace with space
570573
$error['message'] = trim(preg_replace('/\s+/', ' ', $error['message']));
571574
// remove trace and type, will only be present if server is in dev mode

lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ class ConfigOptionsListConstants
6060

6161
/**
6262
* Default limiting input array size for asynchronous Web API
63+
* phpcs:disable
6364
*/
6465
public const CONFIG_PATH_WEBAPI_ASYNC_DEFAULT_INPUT_ARRAY_SIZE_LIMIT = 'webapi/async/default_input_array_size_limit';
66+
//phpcs:enable
6567

6668
/**#@+
6769
* Input keys for the options

0 commit comments

Comments
 (0)