You are here

private function RedirectMiddleware::withTracking in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php \GuzzleHttp\RedirectMiddleware::withTracking()
1 call to RedirectMiddleware::withTracking()
RedirectMiddleware::checkRedirect in vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php

File

vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php, line 118

Class

RedirectMiddleware
Request redirect middleware.

Namespace

GuzzleHttp

Code

private function withTracking(PromiseInterface $promise, $uri) {
  return $promise
    ->then(function (ResponseInterface $response) use ($uri) {

    // Note that we are pushing to the front of the list as this
    // would be an earlier response than what is currently present
    // in the history header.
    $header = $response
      ->getHeader(self::HISTORY_HEADER);
    array_unshift($header, $uri);
    return $response
      ->withHeader(self::HISTORY_HEADER, $header);
  });
}