public function Client::setDefaultHeaders

Set the default HTTP headers to add to each request created by the client

Parameters

array|Collection $headers Default HTTP headers:

Return value

ClientInterface

Overrides ClientInterface::setDefaultHeaders

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Client.php, line 169

Class

Client
HTTP client

Namespace

Guzzle\Http

Code

public function setDefaultHeaders($headers) {
  if ($headers instanceof Collection) {
    $this->defaultHeaders = $headers;
  }
  elseif (is_array($headers)) {
    $this->defaultHeaders = new Collection($headers);
  }
  else {
    throw new InvalidArgumentException('Headers must be an array or Collection');
  }
  return $this;
}