Merge pull request #13425 from nextcloud/backport/13418/stable15

[stable15] HttpClient getHeader can return empty string
This commit is contained in:
Morris Jobke 2019-01-08 17:01:42 +01:00 committed by GitHub
commit bd42f05057
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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];
}
/**