You are here

public function HttpClientBasicAuth::authenticate in Http Client 7.2

Used by the HttpClient to authenticate requests.

Parameters

HttpClientRequest $request:

Return value

void

Overrides HttpClientAuthentication::authenticate

File

includes/auth/basic/HttpClientBasicAuth.inc, line 9

Class

HttpClientBasicAuth

Code

public function authenticate($request) {

  // Some API require only API-key with empty password.
  $request->options['curlopts'][CURLOPT_USERPWD] = !empty($this->password) ? "{$this->username}:{$this->password}" : $this->username;
}