Forgot error handling.
This commit is contained in:
parent
bc43662792
commit
14464c2835
2 changed files with 5 additions and 1 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.2503.72000
|
||||
0.2503.72005
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue