public function AbstractMessage::setHeader

Set an HTTP header

Parameters

string $header Name of the header to set.:

mixed $value Value to set.:

Return value

MessageInterface

Overrides MessageInterface::setHeader

7 calls to AbstractMessage::setHeader()
AbstractMessage::setTokenizedHeader in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/AbstractMessage.php
Set a tokenized header on the request that implodes a Collection of data into a string separated by a token.
EntityEnclosingRequest::processPostFields in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/EntityEnclosingRequest.php
Determine what type of request should be sent based on post fields
EntityEnclosingRequest::setBody in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/EntityEnclosingRequest.php
Set the body of the request
EntityEnclosingRequest::setExpectHeaderCutoff in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/EntityEnclosingRequest.php
Set the size that the entity body of the request must exceed before adding the Expect: 100-Continue header.
Request::addCookie in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/Request.php
Add a Cookie value by name to the Cookie header

... See full list

File

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

Class

AbstractMessage
Abstract HTTP request/response message

Namespace

Guzzle\Http\Message

Code

public function setHeader($header, $value) {

  // Remove any existing header
  $key = strtolower($header);
  unset($this->headers[$key]);
  if ($value instanceof Header) {
    $this->headers[$key] = $value;
  }
  else {

    // Allow for 0, '', and NULL to be set
    if (!$value) {
      $value = array(
        $value,
      );
    }
    $this->headers[$key] = new Header($header, $value);
  }
  $this
    ->changedHeader($key);
  return $this;
}