You are here

public function JsonApiRequestValidator::onRequest in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php \Drupal\jsonapi\EventSubscriber\JsonApiRequestValidator::onRequest()

Validates JSON:API requests.

Parameters

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

File

core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php, line 30

Class

JsonApiRequestValidator
Request subscriber that validates a JSON:API request.

Namespace

Drupal\jsonapi\EventSubscriber

Code

public function onRequest(RequestEvent $event) {
  $request = $event
    ->getRequest();
  if ($request
    ->getRequestFormat() !== 'api_json') {
    return;
  }
  $this
    ->validateQueryParams($request);
}