You are here

protected function BrowserTestBase::drupalGetHeader in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::drupalGetHeader()

Gets the value of an HTTP response header.

If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default.

Parameters

string $name: The name of the header to retrieve. Names are case-insensitive (see RFC 2616 section 4.2).

Return value

string|null The HTTP header value or NULL if not found.

Deprecated

in drupal:9.2.0 and is removed from drupal:10.0.0. Use $this->getSession()->getResponseHeader() instead.

See also

https://www.drupal.org/node/3168383

1 call to BrowserTestBase::drupalGetHeader()
BrowserTestBaseTest::testDrupalGetHeader in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy drupalGetHeader().

File

core/tests/Drupal/Tests/BrowserTestBase.php, line 645

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\Tests

Code

protected function drupalGetHeader($name) {
  @trigger_error('BrowserTestBase::drupalGetHeader() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use $this->getSession()->getResponseHeader() instead. See https://www.drupal.org/node/3168383', E_USER_DEPRECATED);
  return $this
    ->getSession()
    ->getResponseHeader($name);
}