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