Skip to content

Commit 5c665f5

Browse files
authored
Change access to body of Response object (#35)
1 parent defa8a7 commit 5c665f5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ public function authenticate()
109109
sprintf(
110110
'Error code %s received requesting access token: %s.',
111111
$response->getStatusCode(),
112-
$response->getBody()->getContents()
112+
(string) $response->getBody()
113113
)
114114
);
115115
}
116116

117117
if (in_array('application/json', $response->getHeader('Content-Type'))) {
118-
$token = array_merge(json_decode($response->getBody()->getContents(), true), ['created' => time()]);
118+
$token = array_merge(json_decode((string) $response->getBody(), true), ['created' => time()]);
119119
} else {
120-
parse_str($response->getBody()->getContents(), $token);
120+
parse_str((string) $response->getBody(), $token);
121121
$token = array_merge($token, ['created' => time()]);
122122
}
123123

@@ -383,15 +383,15 @@ public function refreshToken($token = null)
383383
sprintf(
384384
'Error code %s received refreshing token: %s.',
385385
$response->getStatusCode(),
386-
$response->getBody()->getContents()
386+
(string) $response->getBody()
387387
)
388388
);
389389
}
390390

391391
if (in_array('application/json', $response->getHeader('Content-Type'))) {
392-
$token = array_merge(json_decode($response->getBody()->getContents(), true), ['created' => time()]);
392+
$token = array_merge(json_decode((string) $response->getBody(), true), ['created' => time()]);
393393
} else {
394-
parse_str($response->getBody()->getContents(), $token);
394+
parse_str((string) $response->getBody(), $token);
395395
$token = array_merge($token, ['created' => time()]);
396396
}
397397

0 commit comments

Comments
 (0)