public function RedirectMiddleware::__invoke in Auth0 Single Sign On 8.2
Parameters
RequestInterface $request:
array $options:
Return value
File
- vendor/
guzzlehttp/ guzzle/ src/ RedirectMiddleware.php, line 49
Class
- RedirectMiddleware
- Request redirect middleware.
Namespace
GuzzleHttpCode
public function __invoke(RequestInterface $request, array $options) {
$fn = $this->nextHandler;
if (empty($options['allow_redirects'])) {
return $fn($request, $options);
}
if ($options['allow_redirects'] === true) {
$options['allow_redirects'] = self::$defaultSettings;
}
elseif (!is_array($options['allow_redirects'])) {
throw new \InvalidArgumentException('allow_redirects must be true, false, or array');
}
else {
// Merge the default settings with the provided settings
$options['allow_redirects'] += self::$defaultSettings;
}
if (empty($options['allow_redirects']['max'])) {
return $fn($request, $options);
}
return $fn($request, $options)
->then(function (ResponseInterface $response) use ($request, $options) {
return $this
->checkRedirect($request, $options, $response);
});
}