示例#1
0
 /**
  * Set the appropriate URL on the request based on the location header
  *
  * @param puzzle_message_RequestInterface  $redirectRequest
  * @param puzzle_message_ResponseInterface $response
  */
 private function setRedirectUrl(puzzle_message_RequestInterface $redirectRequest, puzzle_message_ResponseInterface $response)
 {
     $location = $response->getHeader('Location');
     $location = puzzle_Url::fromString($location);
     // Combine location with the original URL if it is not absolute.
     if (!$location->isAbsolute()) {
         $originalUrl = puzzle_Url::fromString($redirectRequest->getUrl());
         // Remove query string parameters and just take what is present on
         // the redirect Location header
         $originalUrl->getQuery()->clear();
         $location = $originalUrl->combine($location);
     }
     $redirectRequest->setUrl($location);
 }