public function ExceptionJsonSubscriber::on405 in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php \Drupal\Core\EventSubscriber\ExceptionJsonSubscriber::on405()
Handles a 405 error for JSON.
Parameters
\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.
File
- core/
lib/ Drupal/ Core/ EventSubscriber/ ExceptionJsonSubscriber.php, line 63 - Contains \Drupal\Core\EventSubscriber\ExceptionJsonSubscriber.
Class
- ExceptionJsonSubscriber
- Default handling for JSON errors.
Namespace
Drupal\Core\EventSubscriberCode
public function on405(GetResponseForExceptionEvent $event) {
$response = new JsonResponse(array(
'message' => $event
->getException()
->getMessage(),
), Response::HTTP_METHOD_NOT_ALLOWED);
$event
->setResponse($response);
}