protected function RESTTestBase::assertHeader

Check if a HTTP response header exists and has the expected value.

Parameters

string $header: The header key, example: Content-Type

string $value: The header value.

string $message: (optional) A message to display with the assertion.

string $group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

2 calls to RESTTestBase::assertHeader()
DBLogTest::testWatchdog in drupal/core/modules/rest/lib/Drupal/rest/Tests/DBLogTest.php
Writes a log messages and retrieves it via the REST API.
ReadTest::testRead in drupal/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
Tests several valid and invalid read requests on all entity types.

File

drupal/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php, line 227
Definition of Drupal\rest\test\RESTTestBase.

Class

RESTTestBase
Test helper class that provides a REST client method to send HTTP requests.

Namespace

Drupal\rest\Tests

Code

protected function assertHeader($header, $value, $message = '', $group = 'Browser') {
  $header_value = $this
    ->drupalGetHeader($header);
  return $this
    ->assertTrue($header_value == $value, $message ? $message : 'HTTP response header ' . $header . ' with value ' . $value . ' found.', $group);
}