protected function RESTTestBase::drupalGetHeader in Drupal 8
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. However, if TRUE is passed as the second argument, all requests will be processed from last to first until the header is found.
Parameters
$name: The name of the header to retrieve. Names are case-insensitive (see RFC 2616 section 4.2).
$all_requests: Boolean value specifying whether to check all requests if the header is not found in the last request. Defaults to FALSE.
Return value
The HTTP header value or FALSE if not found.
Overrides WebTestBase::drupalGetHeader
File
- core/
modules/ rest/ src/ Tests/ RESTTestBase.php, line 273
Class
- RESTTestBase
- Test helper class that provides a REST client method to send HTTP requests.
Namespace
Drupal\rest\TestsCode
protected function drupalGetHeader($name, $all_requests = FALSE) {
if (!isset($this->response)) {
return parent::drupalGetHeader($name, $all_requests);
}
if ($header = $this->response
->getHeader($name)) {
return implode(', ', $header);
}
}