diff options
author | George Claghorn <george.claghorn@gmail.com> | 2018-04-30 22:48:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 22:48:10 -0400 |
commit | a42fb70a152ee05725685a8f68e3e8e2ddda4b36 (patch) | |
tree | e5a75fc09dc4cc2bc450ccf609a5011e01059497 /actionpack | |
parent | fd9fa7d41f3cc7f5277dfc670ea958673115a1f2 (diff) | |
parent | f9e14b02c460a1963b350fb5e0e10c0e71ee175c (diff) | |
download | rails-a42fb70a152ee05725685a8f68e3e8e2ddda4b36.tar.gz rails-a42fb70a152ee05725685a8f68e3e8e2ddda4b36.tar.bz2 rails-a42fb70a152ee05725685a8f68e3e8e2ddda4b36.zip |
Merge pull request #32773 from eugeneius/content_length_multiple_requests
Reset CONTENT_LENGTH between test requests
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/test_case_test.rb | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 8f2a7e2b5f..5d784ceb31 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -604,6 +604,7 @@ module ActionController env.delete "action_dispatch.request.query_parameters" env.delete "action_dispatch.request.request_parameters" env["rack.input"] = StringIO.new + env.delete "CONTENT_LENGTH" env.delete "RAW_POST_DATA" env end diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index e66c409786..734da3de9c 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -689,6 +689,14 @@ XML assert_equal "foo=baz", @request.raw_post end + def test_content_length_reset_after_post_request + post :no_op, params: { foo: "bar" } + assert_not_equal 0, @request.content_length + + get :no_op + assert_equal 0, @request.content_length + end + def test_path_is_kept_after_the_request get :test_params, params: { id: "foo" } assert_equal "/test_case_test/test/test_params/foo", @request.path |