File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1+ ## [ 2.2.1] - 2025-09-10
2+ - Improve handling of lowercase HTTP response headers.
3+
14## [ 2.2.0] - 2023-05-11
25- Switch to dual licensing under AGPL-3.0 or MIT licenses.
36
Original file line number Diff line number Diff line change @@ -28,10 +28,13 @@ public function __construct(
2828 $ this ->body = $ body ;
2929 $ this ->headers = $ headers ;
3030
31+ // Support case insensitve HTTP header names (Content-Type vs content-type)
32+ $ lowercase_headers = array_change_key_case ($ this ->headers , CASE_LOWER );
33+
3134 // Store decoded JSON data, if present
3235 if (
33- !empty ( $ this -> headers [ ' Content-Type ' ] )
34- && mb_strpos ( $ this -> headers [ ' Content-Type ' ][0 ], 'application/json; ' ) !== false
36+ !empty ( $ lowercase_headers [ ' content-type ' ] )
37+ && mb_strpos ( $ lowercase_headers [ ' content-type ' ][0 ], 'application/json; ' ) !== false
3538 ) {
3639 $ this ->data = json_decode ( $ this ->body , true );
3740
@@ -81,4 +84,3 @@ public function hasError()
8184 return !empty ( $ this ->getError () );
8285 }
8386}
84-
You can’t perform that action at this time.
0 commit comments