File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments