You are here

private function RedirectMiddleware::withTracking in Auth0 Single Sign On 8.2

Enable tracking on promise.

Return value

PromiseInterface

1 call to RedirectMiddleware::withTracking()
RedirectMiddleware::checkRedirect in vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php

File

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

Class

RedirectMiddleware
Request redirect middleware.

Namespace

GuzzleHttp

Code

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

    // 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.
    $historyHeader = $response
      ->getHeader(self::HISTORY_HEADER);
    $statusHeader = $response
      ->getHeader(self::STATUS_HISTORY_HEADER);
    array_unshift($historyHeader, $uri);
    array_unshift($statusHeader, $statusCode);
    return $response
      ->withHeader(self::HISTORY_HEADER, $historyHeader)
      ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader);
  });
}