You are here

protected function RestClient::httpRequest in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequest()
  2. 8.3 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequest()

Make the HTTP request. Wrapper around drupal_http_request().

Parameters

string $url: Path to make request from.

string $data: The request body.

array $headers: Request headers to send as name => value.

string $method: Method to initiate the call, such as GET or POST. Defaults to GET.

Return value

\GuzzleHttp\Psr7\Response Response object.

Throws

\GuzzleHttp\Exception\RequestException Request exception.

3 calls to RestClient::httpRequest()
RestClient::apiHttpRequest in src/Rest/RestClient.php
Private helper to issue an SF API request.
RestClient::getVersions in src/Rest/RestClient.php
Wrapper for "Versions" resource to list information about API releases.
RestClient::httpRequestRaw in src/Rest/RestClient.php
Return raw response content from given URL.

File

src/Rest/RestClient.php, line 306

Class

RestClient
Objects, properties, and methods to communicate with the Salesforce REST API.

Namespace

Drupal\salesforce\Rest

Code

protected function httpRequest($url, $data = NULL, array $headers = [], $method = 'GET') {

  // Build the request, including path and headers. Internal use.
  $args = NestedArray::mergeDeep($this->httpClientOptions, [
    'headers' => $headers,
    'body' => $data,
  ]);
  return $this->httpClient
    ->{$method}($url, $args);
}