You are here

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

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

Validate response.

Parameters

\Drupal\search_api_solr\Solarium\EventDispatcher\EventProxy $event: postExecuteRequest event.

Throws

\Solarium\Exception\HttpException

File

src/EventSubscriber/SearchSubscriber.php, line 107

Class

SearchSubscriber
Extends Solarium plugin: authenticate, etc.

Namespace

Drupal\acquia_search\EventSubscriber

Code

public function postExecuteRequest(EventProxy $event) {

  // If no client exists, its not an acquia solr server.
  if (!$this->client) {
    return;
  }
  $response = $event
    ->getResponse();
  if ($response
    ->getStatusCode() != 200) {
    throw new HttpException($response
      ->getStatusMessage());
  }
  if ($event
    ->getRequest()
    ->getHandler() == 'admin/ping') {
    return;
  }
  $this
    ->authenticateResponse($event
    ->getResponse(), $this->nonce, $this->uri);
}