public function AbstractMessage::addHeader

Add a header to an existing collection of headers.

Parameters

string $header Header name to add:

string $value Value of the header:

Return value

MessageInterface

Overrides MessageInterface::addHeader

3 calls to AbstractMessage::addHeader()
AbstractMessage::addHeaders in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/AbstractMessage.php
Add and merge in an array of HTTP headers.
AbstractMessage::setHeaders in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/AbstractMessage.php
Overwrite all HTTP headers with the supplied array of headers
Request::__construct in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/Request.php
Create a new request

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Message/AbstractMessage.php, line 44

Class

AbstractMessage
Abstract HTTP request/response message

Namespace

Guzzle\Http\Message

Code

public function addHeader($header, $value) {
  $key = strtolower($header);
  if (!isset($this->headers[$key])) {
    $this->headers[$key] = new Header($header, $value);
  }
  else {
    $this->headers[$key]
      ->add($value, $header);
  }
  $this
    ->changedHeader($key);
  return $this;
}