protected function RedirectPlugin::throwTooManyRedirectsException

Throw a too many redirects exception for a request

Parameters

RequestInterface $request Request:

Throws

TooManyRedirectsException when too many redirects have been issued

1 call to RedirectPlugin::throwTooManyRedirectsException()
RedirectPlugin::prepareRedirection in drupal/core/vendor/guzzle/http/Guzzle/Http/RedirectPlugin.php
Prepare the request for redirection and enforce the maximum number of allowed redirects per client

File

drupal/core/vendor/guzzle/http/Guzzle/Http/RedirectPlugin.php, line 210

Class

RedirectPlugin
Plugin to implement HTTP redirects. Can redirect like a web browser or using strict RFC 2616 compliance

Namespace

Guzzle\Http

Code

protected function throwTooManyRedirectsException(RequestInterface $request) {
  $responses = array();

  // Create a nice message to use when throwing the exception that shows each request/response transaction
  do {
    $response = $request
      ->getResponse();
    $responses[] = '> ' . $request
      ->getRawHeaders() . "\n\n< " . $response
      ->getRawHeaders();
    $request = $response
      ->getPreviousResponse() ? $response
      ->getPreviousResponse()
      ->getRequest() : null;
  } while ($request);
  $transaction = implode("* Sending redirect request\n", array_reverse($responses));
  throw new TooManyRedirectsException("Too many redirects were issued for this transaction:\n{$transaction}");
}