\GuzzleHttpRedirectMiddleware

Request redirect middleware.

Apply this middleware like other middleware using {@see \GuzzleHttp\Middleware::redirect()}.

Summary

Methods
Properties
Constants
__construct()
__invoke()
checkRedirect()
modifyRequest()
$defaultSettings
HISTORY_HEADER
STATUS_HISTORY_HEADER
No protected methods found
No protected properties found
N/A
withTracking()
guardMax()
redirectUri()
$nextHandler
N/A

Constants

HISTORY_HEADER

HISTORY_HEADER = 'X-Guzzle-Redirect-History'

STATUS_HISTORY_HEADER

STATUS_HISTORY_HEADER = 'X-Guzzle-Redirect-Status-History'

Properties

$defaultSettings

$defaultSettings : array

Type

array

$nextHandler

$nextHandler

Methods

__construct()

__construct(callable  $nextHandler) : mixed

Parameters

callable $nextHandler

Returns

mixed —

__invoke()

__invoke(\Psr\Http\Message\RequestInterface  $request, array  $options) : \GuzzleHttp\Promise\PromiseInterface

Parameters

\Psr\Http\Message\RequestInterface $request
array $options

Returns

\GuzzleHttp\Promise\PromiseInterface —

checkRedirect()

checkRedirect(\Psr\Http\Message\RequestInterface  $request, array  $options, \Psr\Http\Message\ResponseInterface  $response) : \Psr\Http\Message\ResponseInterface|\GuzzleHttp\Promise\PromiseInterface

Parameters

\Psr\Http\Message\RequestInterface $request
array $options
\Psr\Http\Message\ResponseInterface $response

Returns

\Psr\Http\Message\ResponseInterface|\GuzzleHttp\Promise\PromiseInterface —

modifyRequest()

modifyRequest(\Psr\Http\Message\RequestInterface  $request, array  $options, \Psr\Http\Message\ResponseInterface  $response) : \Psr\Http\Message\RequestInterface

Parameters

\Psr\Http\Message\RequestInterface $request
array $options
\Psr\Http\Message\ResponseInterface $response

Returns

\Psr\Http\Message\RequestInterface —

withTracking()

withTracking(\GuzzleHttp\Promise\PromiseInterface  $promise, string  $uri, int  $statusCode) : \GuzzleHttp\Promise\PromiseInterface

Enable tracking on promise.

Parameters

\GuzzleHttp\Promise\PromiseInterface $promise
string $uri
int $statusCode

Returns

\GuzzleHttp\Promise\PromiseInterface —

guardMax()

guardMax(\Psr\Http\Message\RequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response, array  $options) : void

Check for too many redirects

Parameters

\Psr\Http\Message\RequestInterface $request
\Psr\Http\Message\ResponseInterface $response
array $options

Throws

\GuzzleHttp\Exception\TooManyRedirectsException

Too many redirects.

redirectUri()

redirectUri(\Psr\Http\Message\RequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response, array  $protocols) : \Psr\Http\Message\UriInterface

Set the appropriate URL on the request based on the location header

Parameters

\Psr\Http\Message\RequestInterface $request
\Psr\Http\Message\ResponseInterface $response
array $protocols

Returns

\Psr\Http\Message\UriInterface —