Class WrappedHttpHandler
Converts an HTTP handler into a Command HTTP handler.
HTTP handlers have the following signature: function(RequestInterface $request, array $options) : PromiseInterface
The promise returned form an HTTP handler must resolve to a PSR-7 response object when fulfilled or an error array when rejected. The error array can contain the following data:
- exception: (required, Exception) Exception that was encountered.
- response: (ResponseInterface) PSR-7 response that was received (if a response) was received.
- connection_error: (bool) True if the error is the result of failing to connect.
Methods Summary
- __construct ( callable $httpHandler, callable $parser, callable $errorParser, string $exceptionClass = Aws\AwsException::class, bool $collectStats = false )
-
__invoke ( Aws\CommandInterface $command, Psr\Http\Message\RequestInterface $request )
Calls the simpler HTTP specific handler and wraps the returned promise with AWS specific values (e.g., a result object or AWS exception).
Methods Details
__construct ( callable $httpHandler, callable $parser, callable $errorParser, string $exceptionClass = Aws\AwsException::class, boolean $collectStats = false )
Parameters
callable | $httpHandler | Function that accepts a request and array of request options and returns a promise that fulfills with a response or rejects with an error array. |
callable | $parser | Function that accepts a response object and returns an AWS result object. |
callable | $errorParser | Function that parses a response object into AWS error data. |
string | $exceptionClass = Aws\AwsException::class | Exception class to throw. |
boolean | $collectStats = false | Whether to collect HTTP transfer information. |
GuzzleHttp\Promise\PromiseInterface
__invoke (
Aws\CommandInterface
$command,
Psr\Http\Message\RequestInterface
$request
)
Calls the simpler HTTP specific handler and wraps the returned promise with AWS specific values (e.g., a result object or AWS exception).
Parameters
Aws\CommandInterface |
$command | Command being executed. |
Psr\Http\Message\RequestInterface |
$request | Request to send. |
Returns
GuzzleHttp\Promise\PromiseInterface |