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); }
Please login to continue.