@@ -41,9 +41,11 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 43 | 43 | { |
| 44 | - if ($this->isJsonPayload($request)) { |
|
| 44 | + if ($this->isJsonPayload($request)) |
|
| 45 | + { |
|
| 45 | 46 | $request = $request->withParsedBody(json_decode((string)$request->getBody(), true)); |
| 46 | - if (json_last_error() !== 0) { |
|
| 47 | + if (json_last_error() !== 0) |
|
| 48 | + { |
|
| 47 | 49 | throw new ClientException(400, 'invalid json payload'); |
| 48 | 50 | } |
| 49 | 51 | } |
@@ -59,8 +61,10 @@ discard block |
||
| 59 | 61 | { |
| 60 | 62 | $contentType = $request->getHeaderLine('Content-Type'); |
| 61 | 63 | |
| 62 | - foreach ($this->httpConfig->getJsonContentType() as $allowedType) { |
|
| 63 | - if (stripos($contentType, $allowedType) === 0) { |
|
| 64 | + foreach ($this->httpConfig->getJsonContentType() as $allowedType) |
|
| 65 | + { |
|
| 66 | + if (stripos($contentType, $allowedType) === 0) |
|
| 67 | + { |
|
| 64 | 68 | return true; |
| 65 | 69 | } |
| 66 | 70 | } |