Functions used to create and wrap handlers with handler middleware.
Definition at line 14 of file Middleware.php.
◆ cookies()
static GuzzleHttp\Middleware::cookies |
( |
| ) |
|
|
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.
- Returns
- callable Returns a function that accepts the next handler.
Definition at line 24 of file Middleware.php.
◆ history()
static GuzzleHttp\Middleware::history |
( |
& |
$container | ) |
|
|
static |
Middleware that pushes history data to an ArrayAccess container.
- Parameters
-
array | \ArrayAccess | $container | Container to hold the history (by reference). |
- Returns
- callable Returns a function that accepts the next handler.
- Exceptions
-
Definition at line 80 of file Middleware.php.
◆ httpErrors()
static GuzzleHttp\Middleware::httpErrors |
( |
| ) |
|
|
static |
Middleware that throws exceptions for 4xx or 5xx responses when the "http_error" request option is set to true.
- Returns
- callable Returns a function that accepts the next handler.
Definition at line 52 of file Middleware.php.
◆ log()
static GuzzleHttp\Middleware::log |
( |
LoggerInterface |
$logger, |
|
|
MessageFormatter |
$formatter, |
|
|
|
$logLevel = 'info' |
|
) |
| |
|
static |
◆ mapRequest()
static GuzzleHttp\Middleware::mapRequest |
( |
callable |
$fn | ) |
|
|
static |
Middleware that applies a map function to the request before passing to the next handler.
- Parameters
-
callable | $fn | Function that accepts a RequestInterface and returns a RequestInterface. |
- Returns
- callable
Definition at line 229 of file Middleware.php.
◆ mapResponse()
static GuzzleHttp\Middleware::mapResponse |
( |
callable |
$fn | ) |
|
|
static |
Middleware that applies a map function to the resolved promise's response.
- Parameters
-
callable | $fn | Function that accepts a ResponseInterface and returns a ResponseInterface. |
- Returns
- callable
Definition at line 246 of file Middleware.php.
◆ prepareBody()
static GuzzleHttp\Middleware::prepareBody |
( |
| ) |
|
|
static |
This middleware adds a default content-type if possible, a default content-length or transfer-encoding header, and the expect header.
- Returns
- callable
Definition at line 214 of file Middleware.php.
◆ redirect()
static GuzzleHttp\Middleware::redirect |
( |
| ) |
|
|
static |
Middleware that handles request redirects.
- Returns
- callable Returns a function that accepts the next handler.
Definition at line 146 of file Middleware.php.
◆ retry()
static GuzzleHttp\Middleware::retry |
( |
callable |
$decider, |
|
|
callable |
$delay = null |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- callable Returns a function that accepts the next handler.
Definition at line 168 of file Middleware.php.
◆ tap()
static GuzzleHttp\Middleware::tap |
( |
callable |
$before = null , |
|
|
callable |
$after = null |
|
) |
| |
|
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.
- Parameters
-
callable | $before | Function to invoke before forwarding the request. |
callable | $after | Function invoked after forwarding. |
- Returns
- callable Returns a function that accepts the next handler.
Definition at line 125 of file Middleware.php.
The documentation for this class was generated from the following file: