1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #32773 from eugeneius/content_length_multiple_requests

Reset CONTENT_LENGTH between test requests
This commit is contained in:
George Claghorn 2018-04-30 22:48:10 -04:00 committed by GitHub
commit a42fb70a15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -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

View file

@ -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