Skip to content

Commit 7f6f49d

Browse files
committed
Fix content type check to use getHeader method for JSON response handling - backport from 4.x
1 parent 4e718f1 commit 7f6f49d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function authenticate()
112112
);
113113
}
114114

115-
if (strpos($response->headers['Content-Type'], 'application/json') !== false) {
115+
if (in_array('application/json', $response->getHeader('Content-Type'))) {
116116
$token = array_merge(json_decode($response->body, true), ['created' => time()]);
117117
} else {
118118
parse_str($response->body, $token);
@@ -380,7 +380,7 @@ public function refreshToken($token = null)
380380
);
381381
}
382382

383-
if (strpos($response->headers['Content-Type'], 'application/json') !== false) {
383+
if (in_array('application/json', $response->getHeader('Content-Type'))) {
384384
$token = array_merge(json_decode($response->body, true), ['created' => time()]);
385385
} else {
386386
parse_str($response->body, $token);

0 commit comments

Comments
 (0)