Merge pull request #13418 from nextcloud/fix/11999/headers_can_be_empty

HttpClient getHeader can return empty string
This commit is contained in:
Roeland Jago Douma 2019-01-08 15:35:29 +01:00 committed by GitHub
commit b35db6c784
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];
}
/**