class HttpClientWrapper in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 src/Client/HttpClientWrapper.php \Drupal\salesforce\Client\HttpClientWrapper
- 5.0.x src/Client/HttpClientWrapper.php \Drupal\salesforce\Client\HttpClientWrapper
Wraps Guzzle HTTP client for an OAuth ClientInterface.
Hierarchy
- class \Drupal\salesforce\Client\HttpClientWrapper implements \OAuth\Common\Http\Client\ClientInterface
Expanded class hierarchy of HttpClientWrapper
1 string reference to 'HttpClientWrapper'
1 service uses HttpClientWrapper
File
- src/Client/ HttpClientWrapper.php, line 12 
Namespace
Drupal\salesforce\ClientView source
class HttpClientWrapper implements ClientInterface {
  /**
   * Guzzle HTTP Client service.
   *
   * @var \GuzzleHttp\ClientInterface
   */
  protected $httpClient;
  /**
   * HttpClientWrapper constructor.
   *
   * @param \GuzzleHttp\ClientInterface $httpClient
   *   Guzzle HTTP client service, from core http_client.
   */
  public function __construct(GuzzleClientInterface $httpClient) {
    $this->httpClient = $httpClient;
  }
  /**
   * {@inheritdoc}
   */
  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();
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| HttpClientWrapper:: | protected | property | Guzzle HTTP Client service. | |
| HttpClientWrapper:: | public | function | ||
| HttpClientWrapper:: | public | function | HttpClientWrapper constructor. | 
