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

Update Helper.php #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update Helper.php #17

wants to merge 1 commit into from

Conversation

Axent96
Copy link

@Axent96 Axent96 commented Sep 9, 2024

get Body return StreamInterface & not string

get Body return StreamInterface
@judgej
Copy link
Member

judgej commented Sep 19, 2024

The reason for casting to a string, is that the whole body is streamed and serialised, beginning to end. Using getContents() will only stream what remains of the body, which may be nothing if another step has already read it, so calling extractMessageData() twice will only return the body the first time, and nothing the second time. Casting to string avoids this, and is documented in the PSR-7 recommendation.

Was there a reason for changing that that I'm perhaps missing?

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