public function ClientService::sendRequest in Sparkpost email 8.2
Same name and namespace in other branches
- 8 src/ClientService.php \Drupal\sparkpost\ClientService::sendRequest()
Sends the request.
Parameters
string $endpoint: The endpoint to use.
array $data: The data to send.
string $method: The HTTP method to use.
Return value
array The body of the response.
Overrides ClientServiceInterface::sendRequest
File
- src/
ClientService.php, line 78
Class
- ClientService
- Client service that sends the mails.
Namespace
Drupal\sparkpostCode
public function sendRequest($endpoint, array $data, $method = 'GET') {
$client = $this
->getClient();
$promise = $client
->request($method, $endpoint, $data);
$response = $promise
->wait();
return $response
->getBody();
}