Open Monograph Press
3.3.0
|
Static Public Member Functions | |
static | cookies () |
static | history (&$container) |
static | httpErrors () |
static | log (LoggerInterface $logger, MessageFormatter $formatter, $logLevel='info') |
static | mapRequest (callable $fn) |
static | mapResponse (callable $fn) |
static | prepareBody () |
static | redirect () |
static | retry (callable $decider, callable $delay=null) |
static | tap (callable $before=null, callable $after=null) |
Functions used to create and wrap handlers with handler middleware.
Definition at line 14 of file Middleware.php.
|
static |
Middleware that adds cookies to requests.
The options array must be set to a CookieJarInterface in order to use cookies. This is typically handled for you by a client.
Definition at line 24 of file Middleware.php.
|
static |
Middleware that pushes history data to an ArrayAccess container.
array | \ArrayAccess | $container | Container to hold the history (by reference). |
Definition at line 80 of file Middleware.php.
|
static |
Middleware that throws exceptions for 4xx or 5xx responses when the "http_error" request option is set to true.
Definition at line 52 of file Middleware.php.
References Psr\Http\Message\ResponseInterface\getStatusCode().
|
static |
Middleware that logs requests, responses, and errors using a message formatter.
LoggerInterface | $logger | Logs messages. |
MessageFormatter | $formatter | Formatter used to create message strings. |
string | $logLevel | Level at which to log requests. |
Definition at line 185 of file Middleware.php.
References GuzzleHttp\MessageFormatter\format(), and GuzzleHttp\Exception\RequestException\getResponse().
|
static |
Middleware that applies a map function to the request before passing to the next handler.
callable | $fn | Function that accepts a RequestInterface and returns a RequestInterface. |
Definition at line 229 of file Middleware.php.
|
static |
Middleware that applies a map function to the resolved promise's response.
callable | $fn | Function that accepts a ResponseInterface and returns a ResponseInterface. |
Definition at line 246 of file Middleware.php.
|
static |
This middleware adds a default content-type if possible, a default content-length or transfer-encoding header, and the expect header.
Definition at line 214 of file Middleware.php.
|
static |
Middleware that handles request redirects.
Definition at line 146 of file Middleware.php.
|
static |
Middleware that retries requests based on the boolean result of invoking the provided "decider" function.
If no delay function is provided, a simple implementation of exponential backoff will be utilized.
callable | $decider | Function that accepts the number of retries, a request, [response], and [exception] and returns true if the request is to be retried. |
callable | $delay | Function that accepts the number of retries and returns the number of milliseconds to delay. |
Definition at line 168 of file Middleware.php.
|
static |
Middleware that invokes a callback before and after sending a request.
The provided listener cannot modify or alter the response. It simply "taps" into the chain to be notified before returning the promise. The before listener accepts a request and options array, and the after listener accepts a request, options array, and response promise.
callable | $before | Function to invoke before forwarding the request. |
callable | $after | Function invoked after forwarding. |
Definition at line 125 of file Middleware.php.