Copied!

Request redirect middleware.

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

  • final
Cloneable Instantiable
Constants
public GuzzleHttp\RedirectMiddleware ::HISTORY_HEADER = 'X-Guzzle-Redirect-History'
public GuzzleHttp\RedirectMiddleware ::STATUS_HISTORY_HEADER = 'X-Guzzle-Redirect-Status-History'
Properties
public static $defaultSettings = [ 'max' => 5 , 'protocols' => [ 'http' , 'https' ] , 'strict' => false , 'referer' => false , 'track_redirects' => false ]
 
  • var array
Methods
public __construct ( callable $nextHandler )
 
public __invoke ( Psr\Http\Message\RequestInterface $request , array $options ) : GuzzleHttp\Promise\PromiseInterface
public checkRedirect ( Psr\Http\Message\RequestInterface $request , array $options , Psr\Http\Message\ResponseInterface $response )
 
  • return ResponseInterface | PromiseInterface
public modifyRequest ( Psr\Http\Message\RequestInterface $request , array $options , Psr\Http\Message\ResponseInterface $response ) : Psr\Http\Message\RequestInterface
Properties
private $nextHandler
 
Methods
private guardMax ( Psr\Http\Message\RequestInterface $request , Psr\Http\Message\ResponseInterface $response , array $options ) : void
 

Check for too many redirects.

  • throws TooManyRedirectsException Too many redirects.
private static 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.

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

Enable tracking on promise.

Properties
public static $defaultSettings = [ 'max' => 5 , 'protocols' => [ 'http' , 'https' ] , 'strict' => false , 'referer' => false , 'track_redirects' => false ]
 
  • var array
Methods
private static 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.

© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration