You are here

public function HttpClientWrapper::retrieveResponse in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 src/Client/HttpClientWrapper.php \Drupal\salesforce\Client\HttpClientWrapper::retrieveResponse()
  2. 5.0.x src/Client/HttpClientWrapper.php \Drupal\salesforce\Client\HttpClientWrapper::retrieveResponse()

File

src/Client/HttpClientWrapper.php, line 34

Class

HttpClientWrapper
Wraps Guzzle HTTP client for an OAuth ClientInterface.

Namespace

Drupal\salesforce\Client

Code

public function retrieveResponse(UriInterface $endpoint, $requestBody, array $extraHeaders = [], $method = 'POST') {
  $response = $this->httpClient
    ->request($method, $endpoint
    ->getAbsoluteUri(), [
    'headers' => $extraHeaders,
    'form_params' => $requestBody,
  ]);
  return $response
    ->getBody()
    ->getContents();
}