Skip to content

Commit fc0d7fb

Browse files
committed
Add PSR-15 middleware
1 parent 8168550 commit fc0d7fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Middleware/ValidationExceptionMiddleware.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
5252
try {
5353
return $handler->handle($request);
5454
} catch (ValidationException $exception) {
55-
$response = $this->responseFactory->createResponse()->withStatus(422);
55+
$response = $this->responseFactory->createResponse()
56+
->withStatus(422)
57+
->withHeader('Content-Type', 'application/json');
5658

5759
$response->getBody()->write($this->encoder->encode([
5860
'error' => $exception->getValidation()->toArray(),

0 commit comments

Comments
 (0)