Browse Source

HttpClient getHeader can return empty string

Fixes #11999

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
tags/v16.0.0alpha1
Roeland Jago Douma 5 years ago
parent
commit
08970aaee2
No account linked to committer's email address
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      lib/private/Http/Client/Response.php

+ 7
- 1
lib/private/Http/Client/Response.php 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];
}

/**

Loading…
Cancel
Save