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 rack.input when the environment is scrubbed for the next request #25965

Merged
merged 2 commits into from Jul 28, 2016

Conversation

@nicksieger
Copy link
Contributor

nicksieger commented Jul 27, 2016

Summary

Before this change, posted parameters would leak across requests. The included test case failed like so:

  1) Failure:
TestCaseTest#test_multiple_mixed_method_process_should_scrub_rack_input:
--- expected
+++ actual
@@ -1 +1 @@
-{"bar"=>"an bar", "controller"=>"test_case_test/test", "action"=>"test_params"}
+{"foo"=>"an foo", "bar"=>"an bar", "controller"=>"test_case_test/test", "action"=>"test_params"}

An argument could be made that this situation isn't encountered often and that one should limit the number of requests per test case, but I still think the parameter leaking is an unexpected side-effect.

Before this change, posted parameters would leak across requests. The included
test case failed like so:

      1) Failure:
    TestCaseTest#test_multiple_mixed_method_process_should_scrub_rack_input:
    --- expected
    +++ actual
    @@ -1 +1 @@
    -{"bar"=>"an bar", "controller"=>"test_case_test/test", "action"=>"test_params"}
    +{"foo"=>"an foo", "bar"=>"an bar", "controller"=>"test_case_test/test", "action"=>"test_params"}

An argument could be made that this situation isn't encountered often and that
one should limit the number of requests per test case, but I still think the
parameter leaking is an unexpected side-effect.
@maclover7
Copy link
Member

maclover7 commented Jul 27, 2016

Should we be adding this behavior to ActionDispatch::IntegrationTest as well, if it doesn't already do this? 😬

@nicksieger
Copy link
Contributor Author

nicksieger commented Jul 27, 2016

I'd be happy to add that if it makes sense. I'll take a look shortly.

@nicksieger
Copy link
Contributor Author

nicksieger commented Jul 28, 2016

Looks like AD::IntegrationTest already works as expected. Adding a passing test case.

@guilleiguaran
Copy link
Member

guilleiguaran commented Jul 28, 2016

Thank you very much 👏

@guilleiguaran guilleiguaran merged commit 3916656 into rails:master Jul 28, 2016
2 checks passed
2 checks passed
codeclimate Code Climate has skipped analysis of this commit.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nicksieger
Copy link
Contributor Author

nicksieger commented Jul 29, 2016

@rafaelfranca how many branches back should this go?

@maclover7
Copy link
Member

maclover7 commented Jul 29, 2016

@nicksieger this should be backported to 5-0-stable.

@nicksieger nicksieger mentioned this pull request Jul 29, 2016
@nicksieger nicksieger deleted the nicksieger:ac_test_case_reset_rack_input branch Jul 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.