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

Reset CONTENT_LENGTH between test requests #32773

Merged

Conversation

@eugeneius
Copy link
Member

@eugeneius eugeneius commented May 1, 2018

Followup to #32673.
Fixes #32767.

set_header "CONTENT_LENGTH", data_stream.length.to_s
set_header "rack.input", data_stream

If a POST request is followed by a GET request in a controller test, the rack.input and RAW_POST_DATA headers from the first request will be reset but the CONTENT_LENGTH header will leak, leading the request object in the second request to incorrectly believe it has a body.

r? @georgeclaghorn

If a POST request is followed by a GET request in a controller test, the
`rack.input` and `RAW_POST_DATA` headers from the first request will be
reset but the `CONTENT_LENGTH` header will leak, leading the request
object in the second request to incorrectly believe it has a body.
@mmoll
Copy link

@mmoll mmoll commented May 1, 2018

I can confirm this indeed fixes GH-32767 🎉

@georgeclaghorn georgeclaghorn merged commit a42fb70 into rails:master May 1, 2018
2 checks passed
2 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
georgeclaghorn added a commit that referenced this pull request May 1, 2018
…ests

Reset CONTENT_LENGTH between test requests
@georgeclaghorn
Copy link
Contributor

@georgeclaghorn georgeclaghorn commented May 1, 2018

Backported in 5699abf.

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

Successfully merging this pull request may close these issues.

None yet

3 participants