public function HttpClientRequest::addHeader in Http Client 7.2
Same name and namespace in other branches
- 6.2 includes/HttpClient.inc \HttpClientRequest::addHeader()
Appends a header value. Use HttpClientRequest::setHeader() it you want to set the value of a header.
Parameters
string $name:
string $value:
Return value
void
File
- includes/
HttpClient.inc, line 615
Class
- HttpClientRequest
- This is a convenience class that allows the manipulation of a http request before it's handed over to curl.
Code
public function addHeader($name, $value) {
if (!is_array($value)) {
$this->headers[$name][] = $value;
}
else {
$values = isset($this->headers[$name]) ? $this->headers[$name] : array();
$this->headers[$name] = $values + $value;
}
}