RequestInterface
$request,
ResponseInterface
$response,
array
$protocols ): UriInterface
{ $location = Psr7\UriResolver::
resolve( $request->
getUri(),
new Psr7\
Uri($response->
getHeaderLine('Location'
)) );
// Ensure that the redirect URI is allowed based on the protocols.
if (!\
in_array($location->
getScheme(),
$protocols)) { throw new BadResponseException(\
sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s',
$location, \
implode(', ',
$protocols)),
$request,
$response);
} return $location;
}}