ExceptionJsonSubscriber::on415

public ExceptionJsonSubscriber::on415(GetResponseForExceptionEvent $event)

Handles a 415 error for JSON.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.

File

core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php, line 91

Class

ExceptionJsonSubscriber
Default handling for JSON errors.

Namespace

Drupal\Core\EventSubscriber

Code

public function on415(GetResponseForExceptionEvent $event) {
  $response = new JsonResponse(['message' => $event->getException()->getMessage()], Response::HTTP_UNSUPPORTED_MEDIA_TYPE);
  $event->setResponse($response);
}
doc_Drupal
2016-10-29 09:09:22
Comments
Leave a Comment

Please login to continue.