Forgot error handling.

This commit is contained in:
flash 2025-03-07 20:06:09 +00:00
parent bc43662792
commit 14464c2835
Signed by: flash
GPG key ID: 2C9C2C574D47FE3E
2 changed files with 5 additions and 1 deletions
VERSION
src/Http/Routing

View file

@ -1 +1 @@
0.2503.72000
0.2503.72005

View file

@ -219,6 +219,7 @@ class Router implements RequestHandlerInterface {
if(empty($methods)) {
$context->response->statusCode = 404;
$context->response->reasonPhrase = '';
$this->errorHandler->handle($context);
return $context->response->toResponse();
}
@ -236,6 +237,8 @@ class Router implements RequestHandlerInterface {
if(!array_key_exists($context->request->method, $methods)) {
if($context->request->method === 'OPTIONS') {
// this should include CORS stuff
// should have an entry in RouteInfo which get aggregated here, but also attributes
$context->response->statusCode = 204;
$context->response->reasonPhrase = '';
$context->response->setAllow($getAllowedMethods());
@ -246,6 +249,7 @@ class Router implements RequestHandlerInterface {
$context->response->statusCode = 405;
$context->response->reasonPhrase = '';
$context->response->setAllow($getAllowedMethods());
$this->errorHandler->handle($context);
return $context->response->toResponse();
}
}