public function ResourceResponseValidator::onResponse in Drupal 9
Same name and namespace in other branches
- 8 core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator::onResponse()
Validates JSON:API responses.
Parameters
\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The event to process.
File
- core/
modules/ jsonapi/ src/ EventSubscriber/ ResourceResponseValidator.php, line 102
Class
- ResourceResponseValidator
- Response subscriber that validates a JSON:API response.
Namespace
Drupal\jsonapi\EventSubscriberCode
public function onResponse(ResponseEvent $event) {
$response = $event
->getResponse();
if (strpos($response->headers
->get('Content-Type'), 'application/vnd.api+json') === FALSE) {
return;
}
$this
->doValidateResponse($response, $event
->getRequest());
}