function JsonApiRequestValidator::onRequest

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php \Drupal\jsonapi\EventSubscriber\JsonApiRequestValidator::onRequest()
  2. 10 core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php \Drupal\jsonapi\EventSubscriber\JsonApiRequestValidator::onRequest()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.