Skip to content

Fixes Response::getBody->getContents() returns empty string (#34) - #35

Merged
itafroma merged 2 commits into
acquia:masterfrom
mhouriet:fix-34-rewind-stream
Jan 9, 2018
Merged

Fixes Response::getBody->getContents() returns empty string (#34)#35
itafroma merged 2 commits into
acquia:masterfrom
mhouriet:fix-34-rewind-stream

Conversation

@mhouriet

@mhouriet mhouriet commented Jan 8, 2018

Copy link
Copy Markdown
Contributor

In the ResponseSigner::signResponse($response), the stream of the response body wasn't rewound, meaning calling (the same instance of) $response->getBody()->getContents() afterwards when using the middleware would always return an empty string. However, using Response::getBody() as a string through implicit or explicit casting would already work previously, because __toString() always rewinds.

Unit test included, breaks as expected with previous version of signResponse().

@itafroma
itafroma merged commit 6f88863 into acquia:master Jan 9, 2018
@itafroma

itafroma commented Jan 9, 2018

Copy link
Copy Markdown
Contributor

Thanks for this, looks great! Merged.

@itafroma

Copy link
Copy Markdown
Contributor

Released as part of v3.2.2.

itafroma added a commit to EDSI-Tech/http-hmac-php that referenced this pull request Mar 19, 2018
* master:
  Add PHP 7.2 support, change PHPUnit namespace, improve test coverage (acquia#38)
  Bump minor version in README.
  Update README
  ACM-484: Add a base64 key/secret encoder (acquia#37)
  Ensure response body is rewound after signing response (acquia#35)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants