You are here

public static function Request::setTrustedHeaderName in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()

Sets the name for trusted headers.

The following header keys are supported:

Setting an empty value allows to disable the trusted header for the given key.

Parameters

string $key The header key:

string $value The header name:

Throws

\InvalidArgumentException

4 calls to Request::setTrustedHeaderName()
InlineFragmentRendererTest::testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled in vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php
InlineFragmentRendererTest::testRenderWithTrustedHeaderDisabled in vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php
RequestTest::testSetTrustedProxiesInvalidHeaderName in vendor/symfony/http-foundation/Tests/RequestTest.php
@expectedException \InvalidArgumentException
RequestTest::testTrustedProxies in vendor/symfony/http-foundation/Tests/RequestTest.php

File

vendor/symfony/http-foundation/Request.php, line 606

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public static function setTrustedHeaderName($key, $value) {
  if (!array_key_exists($key, self::$trustedHeaders)) {
    throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
  }
  self::$trustedHeaders[$key] = $value;
}