You are here

protected function SearchApiAcquiaSearchConnectionV3::sendRawPost in Acquia Search for Search API 7.2

Sends a PUT request to the Solr server.

Parameters

string $url: The URL to which the request should be sent.

array $options: Additional options for the request, as recognized by drupal_http_request().

Return value

object The HTTP response, as returned by drupal_http_request().

Throws

SearchApiException If an error occurs, either during sending or on the server side.

Overrides SearchApiSolrConnection::sendRawPost

File

includes/v3/SearchApiAcquiaSearchConnectionV3.php, line 43

Class

SearchApiAcquiaSearchConnectionV3
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

protected function sendRawPost($url, $options = []) {

  // phpcs:ignore
  $options['method'] = 'POST';
  if (!isset($options['headers']['Content-Type'])) {
    $options['headers']['Content-Type'] = 'text/xml; charset=UTF-8';
  }
  $nonce = SearchApiAcquiaCrypt::randomBytes(24);
  $this
    ->prepareRequest($url, $options, $nonce);
  $response = $this
    ->makeHttpRequest($url, $options);
  $response = $this
    ->checkResponse($response);
  return $this
    ->authenticateResponse($response, $nonce, $url);
}