WordPress\AiClient\Providers\Http
HttpTransporter::sendWithGuzzle
Sends a request using a Guzzle-compatible client.
Method of the class: HttpTransporter{}
No Hooks.
Returns
ResponseInterface. The PSR-7 response received.
Usage
// private - for code of main (parent) class only $result = $this->sendWithGuzzle( $request, $options ): ResponseInterface;
- $request(RequestInterface) (required)
- The PSR-7 request to send.
- $options(RequestOptions) (required)
- The request options.
Changelog
| Since 0.2.0 | Introduced. |
HttpTransporter::sendWithGuzzle() HttpTransporter::sendWithGuzzle code WP 7.0
private function sendWithGuzzle(RequestInterface $request, RequestOptions $options): ResponseInterface
{
$guzzleOptions = $this->buildGuzzleOptions($options);
/** @var callable $callable */
$callable = [$this->client, 'send'];
/** @var ResponseInterface $response */
$response = $callable($request, $guzzleOptions);
return $response;
}