Skip to content

Commit 962ce62

Browse files
committed
status reason canse insencitive
1 parent 5bcbda8 commit 962ce62

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Client.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ public function request(
223223
return $response;
224224
}
225225

226-
$responseHeaders = $this->normalizeHeader($parsedResponse['header']);
227-
$errorMessage = $responseHeaders['X-Status-Reason'] ?? '';
226+
$responseHeaders = $this->parseHeader($parsedResponse['header']);
227+
$errorMessage = $responseHeaders['x-status-reason'] ?? '';
228228

229229
throw new ResponseError($response, $errorMessage, $responseCode ?? 0);
230230
}
@@ -297,15 +297,15 @@ private function parseResponse(string $response): array
297297
/**
298298
* @return string[]
299299
*/
300-
private function normalizeHeader(string $header): array
300+
private function parseHeader(string $header): array
301301
{
302302
preg_match_all('/(.*?): (.*)\r\n/', $header, $matches);
303303

304304
$headerArray = [];
305305

306306
foreach ($matches[1] as $index => $name) {
307307
if (isset($matches[2][$index])) {
308-
$headerArray[$name] = trim($matches[2][$index]);
308+
$headerArray[strtolower($name)] = trim($matches[2][$index]);
309309
}
310310
}
311311

0 commit comments

Comments
 (0)