RedirectMiddleware
in package
Request redirect middleware.
Apply this middleware like other middleware using Middleware::redirect().
Tags
Table of Contents
Constants
- HISTORY_HEADER = 'X-Guzzle-Redirect-History'
- STATUS_HISTORY_HEADER = 'X-Guzzle-Redirect-Status-History'
Properties
- $defaultSettings : array<string|int, mixed>
- $nextHandler : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
Methods
- __construct() : mixed
- __invoke() : PromiseInterface
- checkRedirect() : ResponseInterface|PromiseInterface
- modifyRequest() : RequestInterface
- guardMax() : void
- Check for too many redirects.
- redirectUri() : UriInterface
- Set the appropriate URL on the request based on the location header.
- withTracking() : PromiseInterface
- Enable tracking on promise.
Constants
HISTORY_HEADER
public
mixed
HISTORY_HEADER
= 'X-Guzzle-Redirect-History'
STATUS_HISTORY_HEADER
public
mixed
STATUS_HISTORY_HEADER
= 'X-Guzzle-Redirect-Status-History'
Properties
$defaultSettings
public
static array<string|int, mixed>
$defaultSettings
= ['max' => 5, 'protocols' => ['http', 'https'], 'strict' => false, 'referer' => false, 'track_redirects' => false]
$nextHandler
private
callable(RequestInterface, array<string|int, mixed>): PromiseInterface
$nextHandler
Methods
__construct()
public
__construct(callable(RequestInterface, array<string|int, mixed>): PromiseInterface $nextHandler) : mixed
Parameters
- $nextHandler : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
-
Next handler to invoke.
__invoke()
public
__invoke(RequestInterface $request, array<string|int, mixed> $options) : PromiseInterface
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
Return values
PromiseInterfacecheckRedirect()
public
checkRedirect(RequestInterface $request, array<string|int, mixed> $options, ResponseInterface $response) : ResponseInterface|PromiseInterface
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $response : ResponseInterface
Return values
ResponseInterface|PromiseInterfacemodifyRequest()
public
modifyRequest(RequestInterface $request, array<string|int, mixed> $options, ResponseInterface $response) : RequestInterface
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
- $response : ResponseInterface
Return values
RequestInterfaceguardMax()
Check for too many redirects.
private
guardMax(RequestInterface $request, ResponseInterface $response, array<string|int, mixed> &$options) : void
Parameters
- $request : RequestInterface
- $response : ResponseInterface
- $options : array<string|int, mixed>
Tags
redirectUri()
Set the appropriate URL on the request based on the location header.
private
static redirectUri(RequestInterface $request, ResponseInterface $response, array<string|int, mixed> $protocols) : UriInterface
Parameters
- $request : RequestInterface
- $response : ResponseInterface
- $protocols : array<string|int, mixed>
Return values
UriInterfacewithTracking()
Enable tracking on promise.
private
withTracking(PromiseInterface $promise, string $uri, int $statusCode) : PromiseInterface
Parameters
- $promise : PromiseInterface
- $uri : string
- $statusCode : int