Skip to content

Commit

Permalink
Add empty reason phrase when returning a response.
Browse files Browse the repository at this point in the history
Instead of omitting the parameter, provide an empty string to restore default behaviour of looking it up. This works around a diactoros bug.
  • Loading branch information
gsteel committed Apr 6, 2022
1 parent ae70b3a commit 929eb0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Middleware/ErrorDocumentSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function process(Request $request, DelegateInterface $delegate) : Respons
}

$response = $delegate->handle($request);
return $response->withStatus(404);
return $response->withStatus(404, '');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Middleware/ErrorResponseGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public function __invoke(Throwable $error, Request $request, Response $response)
try {
if ($error instanceof DocumentNotFoundException) {
$response = $this->notFoundPipeline->process($request, $this);
return $response->withStatus(404);
return $response->withStatus(404, '');
}
$response = $this->errorPipeline->process($request, $this);
return $response->withStatus(500);
return $response->withStatus(500, '');
} catch (\Throwable $e) {
return $this->generateFallbackResponse();
}
Expand Down

0 comments on commit 929eb0b

Please sign in to comment.