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

Respecting the Content-Length header when turning HTTP bodies into strings #56

Merged
merged 3 commits into from
Jan 5, 2016

Conversation

evert
Copy link
Member

@evert evert commented Jan 4, 2016

getBodyAsString should only return at most as many bytes as the value of Content-Length, this allows users to pass much larger streams without having to copy and truncate them.

@evert evert self-assigned this Jan 4, 2016
@evert evert mentioned this pull request Jan 4, 2016
18 tasks
evert added a commit that referenced this pull request Jan 5, 2016
Respecting the Content-Length header when turning HTTP bodies into strings
@evert evert merged commit 9374552 into master Jan 5, 2016
@evert evert deleted the respect-contentlength branch January 5, 2016 00:48
@@ -74,7 +74,12 @@ function getBodyAsString() {
if (is_null($body)) {
return '';
}
return stream_get_contents($body);
$contentLength = $this->getHeader('Content-Length');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this dependency on global state should be mentioned in the method docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants