Handle the HttpMethodNotAllowedException in the ErrorController

refs #6281
This commit is contained in:
Eric Lippmann 2015-05-22 09:15:52 +02:00
parent 71a2324cb9
commit 3f608fda24
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@
use Icinga\Application\Icinga;
use Icinga\Application\Logger;
use Icinga\Exception\Http\HttpMethodNotAllowedException;
use Icinga\Exception\HttpNotFoundException;
use Icinga\Exception\MissingParameterException;
use Icinga\Security\SecurityException;
@ -46,6 +47,10 @@ class ErrorController extends ActionController
break;
default:
switch (true) {
case $exception instanceof HttpMethodNotAllowedException:
$this->getResponse()->setHttpResponseCode(405);
$this->getResponse()->setHeader('Allow', $exception->getAllowedMethods());
break;
case $exception instanceof HttpNotFoundException:
$this->getResponse()->setHttpResponseCode(404);
break;