Merge pull request #13426 from nextcloud/backport/13418/stable14

[stable14] HttpClient getHeader can return empty string
This commit is contained in:
Morris Jobke 2019-01-08 17:02:02 +01:00 committed by GitHub
commit 596d69d23d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

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