HttpClient getHeader can return empty string

Fixes #11999

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-01-07 22:08:32 +01:00
parent 68b478ea86
commit 08970aaee2
No known key found for this signature in database
GPG key ID: F941078878347C0C

View file

@ -71,7 +71,13 @@ class Response implements IResponse {
* @return string
*/
public function getHeader(string $key): string {
return $this->response->getHeader($key)[0];
$headers = $this->response->getHeader($key);
if (count($headers) === 0) {
return '';
}
return $headers[0];
}
/**