You are here

public function SearchSubscriber::postExecuteRequest in Acquia Search 3.x

Same name and namespace in other branches
  1. 2.x src/EventSubscriber/SearchSubscriber.php \Drupal\acquia_search\EventSubscriber\SearchSubscriber::postExecuteRequest()

Validate response.

Parameters

\Solarium\Core\Event\PostExecuteRequest $event: postExecuteRequest event.

Throws

\Solarium\Exception\HttpException

File

src/EventSubscriber/SearchSubscriber.php, line 135

Class

SearchSubscriber
Class SearchSubscriber.

Namespace

Drupal\acquia_search\EventSubscriber

Code

public function postExecuteRequest(PostExecuteRequest $event) {
  if (!$this->client instanceof Client) {
    return;
  }
  $response = $event
    ->getResponse();
  if ($response
    ->getStatusCode() != 200) {
    throw new HttpException($response
      ->getStatusMessage(), $response
      ->getStatusCode(), $response
      ->getBody());
  }
  if ($event
    ->getRequest()
    ->getHandler() == 'admin/ping') {
    return;
  }
  $this
    ->authenticateResponse($event
    ->getResponse(), $this->nonce, $this->uri);
}