You are here

public function ResourceResponseValidator::doValidateResponse in JSON:API 8.2

Same name and namespace in other branches
  1. 8 src/EventSubscriber/ResourceResponseValidator.php \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator::doValidateResponse()

Wraps validation in an assert to prevent execution in production.

See also

self::validateResponse

1 call to ResourceResponseValidator::doValidateResponse()
ResourceResponseValidator::onResponse in src/EventSubscriber/ResourceResponseValidator.php
Validates JSON:API responses.

File

src/EventSubscriber/ResourceResponseValidator.php, line 149

Class

ResourceResponseValidator
Response subscriber that validates a JSON:API response.

Namespace

Drupal\jsonapi\EventSubscriber

Code

public function doValidateResponse(Response $response, Request $request) {
  if (PHP_MAJOR_VERSION >= 7 || assert_options(ASSERT_ACTIVE)) {
    assert($this
      ->validateResponse($response, $request), 'A JSON:API response failed validation (see the logs for details). Please report this in the issue queue on drupal.org');
  }
}