@@ -41,9 +41,9 @@ 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 | $request = $request->withParsedBody(json_decode((string)$request->getBody(), true)); |
| 46 | - if (json_last_error() !== 0) { |
|
| 46 | + if (json_last_error() !== 0){ |
|
| 47 | 47 | throw new ClientException(400, 'invalid json payload'); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $contentType = $request->getHeaderLine('Content-Type'); |
| 61 | 61 | |
| 62 | - foreach ($this->httpConfig->getJsonContentType() as $allowedType) { |
|
| 63 | - if (stripos($contentType, $allowedType) === 0) { |
|
| 62 | + foreach ($this->httpConfig->getJsonContentType() as $allowedType){ |
|
| 63 | + if (stripos($contentType, $allowedType) === 0){ |
|
| 64 | 64 | return true; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -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 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $rbac->addRole('demo'); |
| 53 | 53 | $rbac->associate('demo', 'demo.*'); |
| 54 | 54 | |
| 55 | - $views->addDirectory('custom', __DIR__ . '/../../views/custom/'); |
|
| 55 | + $views->addDirectory('custom', __DIR__.'/../../views/custom/'); |
|
| 56 | 56 | $views->addEngine(TestEngine::class); |
| 57 | 57 | |
| 58 | 58 | $validation->addAlias('aliased', 'notEmpty'); |