Skip to content

Commit

Permalink
Replace PSR7 rewind with body rewind
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderlissenburg committed Jun 3, 2024
1 parent 395e2b2 commit e9e8548
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Picqer/Financials/Moneybird/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function needsAuthentication()
private function parseResponse(Response $response)
{
try {
Psr7\rewind_body($response);
$response->getBody()->rewind();
$json = json_decode($response->getBody()->getContents(), true);

return $json;
Expand Down Expand Up @@ -477,7 +477,7 @@ private function acquireAccessToken()
$response = $this->client()->post($this->getTokenUrl(), $body);

if ($response->getStatusCode() == 200) {
Psr7\rewind_body($response);
$response->getBody()->rewind();
$body = json_decode($response->getBody()->getContents(), true);

if (json_last_error() === JSON_ERROR_NONE) {
Expand Down Expand Up @@ -512,7 +512,7 @@ private function parseExceptionForErrorMessages(Exception $exception)
return new ApiException('Response is NULL.', 0, $exception);
}

Psr7\rewind_body($response);
$response->getBody()->rewind();
$responseBody = $response->getBody()->getContents();
$decodedResponseBody = json_decode($responseBody, true);

Expand Down
2 changes: 1 addition & 1 deletion tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testClientTriesToGetAccessTokenWhenNoneGiven()
$request = $this->getRequestFromHistoryContainer();
$this->assertEquals('POST', $request->getMethod());

Psr7\rewind_body($request);
$request->getBody()->rewind();
$this->assertEquals(
'redirect_uri=testRedirectUrl&grant_type=authorization_code&client_id=testClientId&client_secret=testClientSecret&code=testAuthorizationCode',
$request->getBody()->getContents()
Expand Down

0 comments on commit e9e8548

Please sign in to comment.