Skip to content

Commit bd42f05

Browse files
authored
Merge pull request #13425 from nextcloud/backport/13418/stable15
[stable15] HttpClient getHeader can return empty string
2 parents 32db64a + bc07098 commit bd42f05

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/private/Http/Client/Response.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ public function getStatusCode(): int {
7171
* @return string
7272
*/
7373
public function getHeader(string $key): string {
74-
return $this->response->getHeader($key)[0];
74+
$headers = $this->response->getHeader($key);
75+
76+
if (count($headers) === 0) {
77+
return '';
78+
}
79+
80+
return $headers[0];
7581
}
7682

7783
/**

0 commit comments

Comments
 (0)