public function Client::setUserAgent

Set the name of your application and application version that will be appended to the User-Agent header of all requests.

Parameters

string $userAgent User agent string:

bool $includeDefault Set to TRUE to append the default Guzzle use agent:

Return value

ClientInterface

Overrides ClientInterface::setUserAgent

File

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

Class

Client
HTTP client

Namespace

Guzzle\Http

Code

public function setUserAgent($userAgent, $includeDefault = false) {
  if ($includeDefault) {
    $userAgent .= ' ' . Utils::getDefaultUserAgent();
  }
  $this->defaultHeaders
    ->set('User-Agent', $userAgent);
  return $this;
}