Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Rewind http client response after recording #1114

Merged
merged 2 commits into from
Aug 12, 2021

Conversation

emargareten
Copy link
Contributor

When response is recorded it sets the response stream to eof and when trying to access the contents of the stream you get an empty string.

This PR rewinds the stream to beginning after copying the content of the response.

To reproduce

$response = Http::get('https://httpbin.org/get');

echo $response->toPsrResponse()->getBody()->getContents();

@driesvints driesvints changed the title Rewind http client response after recording [4.x] Rewind http client response after recording Aug 12, 2021
@taylorotwell taylorotwell merged commit f195871 into laravel:4.x Aug 12, 2021
@emargareten emargareten deleted the patch-1 branch August 12, 2021 12:51
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.

3 participants