You are here

public function JsonApiRequestValidator::onRequest in JSON:API 8.2

Validates JSON:API requests.

Parameters

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

File

src/EventSubscriber/JsonApiRequestValidator.php, line 30

Class

JsonApiRequestValidator
Request subscriber that validates a JSON:API request.

Namespace

Drupal\jsonapi\EventSubscriber

Code

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