src/Tool/ProviderRedirectTrait.php
protected function followRequestRedirects(RequestInterface $request)
    {
        $response = null;
        $attempts = 0;

        while ($attempts < $this->redirectLimit) {
            $attempts++;
            $response = $this->getHttpClient()->send($request, [
                'allow_redirects' => false
            ]);

            if ($this->isRedirect($response)) {
                $redirectUrl = new Uri($response->getHeader('Location')[0]);
                $request = $request->withUri($redirectUrl);
            } else {
                break;
            }
        }

        return $response;
    }
protected function followRequestRedirects(RequestInterface $request)
    {
        $response = null;
        $attempts = 0;

        while ($attempts < $this->redirectLimit) {
            $attempts++;
            $response = $this->getHttpClient()->send($request, [
                'allow_redirects' => false
            ]);

            if ($this->isRedirect($response)) {
                $redirectUrl = new Uri($response->getHeader('Location')[0]);
                $request = $request->withUri($redirectUrl);
            } else {
                break;
            }
        }

        return $response;
    }
protected function followRequestRedirects ( RequestInterface $ request ) { $ response = null ; $ attempts = 0 ; while ( $ attempts < $ this -> redirectLimit ) { $ attempts ++ ; $ response = $ this -> getHttpClient ( ) -> send ( $ request , [ 'allow_redirects' => false ] ) ; if ( $ this -> isRedirect ( $ response ) ) { $ redirectUrl = new Uri ( $ response -> getHeader ( 'Location' ) [ 0 ] ) ; $ request = $ request -> withUri ( $ redirectUrl ) ; } else { break ; } } return $ response ; }
Retrieves a response for a given request and retrieves subsequent
responses, with authorization headers, if a redirect is detected.

@param  RequestInterface $request
@return ResponseInterface
@throws BadResponseException
Retrieves a response for a given request and retrieves subsequent responses with authorization headers if a redirect is detected .