HttpClientWrapper.php in Salesforce Suite 5.0.x
File
src/Client/HttpClientWrapper.php
View source
<?php
namespace Drupal\salesforce\Client;
use GuzzleHttp\ClientInterface as GuzzleClientInterface;
use OAuth\Common\Http\Client\ClientInterface;
use OAuth\Common\Http\Uri\UriInterface;
class HttpClientWrapper implements ClientInterface {
protected $httpClient;
public function __construct(GuzzleClientInterface $httpClient) {
$this->httpClient = $httpClient;
}
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();
}
}