public function GuzzleConnectionDebug::performRequest in Elasticsearch Connector 7
Same name and namespace in other branches
- 7.5 modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc \Elasticsearch\Connections\GuzzleConnectionDebug::performRequest()
- 7.2 modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc \Elasticsearch\Connections\GuzzleConnectionDebug::performRequest()
Perform an HTTP request on the cluster
Parameters
string $method HTTP method to use for request:
string $uri HTTP URI to use for request:
null|string $params Optional URI parameters:
null|string $body Optional request body:
array $options:
Return value
array
File
- modules/
elasticsearch_connector_devel/ includes/ GuzzleConnectionDebugging.inc, line 101
Class
Namespace
Elasticsearch\ConnectionsCode
public function performRequest($method, $uri, $params = null, $body = null, $options = array()) {
$uri = $this
->getURI($uri, $params);
$options += $this->connectionOpts;
$request = $this
->buildGuzzleRequest($method, $uri, $body, $options);
self::$debugOutput[] = array(
'request' => array(
'method' => $method,
'uri' => $uri,
'params' => $params,
'body' => $body,
'options' => $options,
),
);
$time = time();
$response = $this
->sendRequest($request, $body);
self::$debugOutput[] = array(
'response' => array(
'status' => $response
->getStatusCode(),
'text' => $response
->getBody(true),
'info' => $response
->getInfo(),
),
);
return array(
'status' => $response
->getStatusCode(),
'text' => $response
->getBody(true),
'info' => $response
->getInfo(),
);
}