You are here

protected function BlueprintManager::forwardHeader in Subrequests 3.x

Same name and namespace in other branches
  1. 8.2 src/Blueprint/BlueprintManager.php \Drupal\subrequests\Blueprint\BlueprintManager::forwardHeader()

Forward the master request's header to the subrequest.

Parameters

string $name: The header name to forward.

\Symfony\Component\HttpFoundation\Request $from: The request to copy headers from.

\Drupal\subrequests\SubrequestsTree $tree: The target request to copy headers to.

1 call to BlueprintManager::forwardHeader()
BlueprintManager::parse in src/Blueprint/BlueprintManager.php
Takes the user input and returns a subrequest tree ready for execution.

File

src/Blueprint/BlueprintManager.php, line 107

Class

BlueprintManager

Namespace

Drupal\subrequests\Blueprint

Code

protected function forwardHeader($name, Request $from, SubrequestsTree $tree) {
  foreach ($tree as $level) {
    foreach ($level as $subrequest) {

      /** @var $subrequest \Drupal\subrequests\Subrequest */
      if (isset($subrequest->headers[$name])) {
        continue;
      }
      $subrequest->headers[$name] = $from->headers
        ->get($name);
    }
  }
}