diff options
-rw-r--r-- | actionpack/lib/action_dispatch/testing/test_request.rb | 2 | ||||
-rw-r--r-- | actionpack/test/dispatch/test_request_test.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/testing/test_request.rb b/actionpack/lib/action_dispatch/testing/test_request.rb index d0beb72a41..91b25ec155 100644 --- a/actionpack/lib/action_dispatch/testing/test_request.rb +++ b/actionpack/lib/action_dispatch/testing/test_request.rb @@ -22,7 +22,7 @@ module ActionDispatch private_class_method :default_env def request_method=(method) - set_header("REQUEST_METHOD", method.to_s.upcase) + super(method.to_s.upcase) end def host=(host) diff --git a/actionpack/test/dispatch/test_request_test.rb b/actionpack/test/dispatch/test_request_test.rb index 35af3076ba..b479af781d 100644 --- a/actionpack/test/dispatch/test_request_test.rb +++ b/actionpack/test/dispatch/test_request_test.rb @@ -88,6 +88,13 @@ class TestRequestTest < ActiveSupport::TestCase assert_equal "GoogleBot", req.user_agent end + test "request_method getter and setter" do + req = ActionDispatch::TestRequest.create + req.request_method # to reproduce bug caused by memoization + req.request_method = "POST" + assert_equal "POST", req.request_method + end + test "setter methods" do req = ActionDispatch::TestRequest.create({}) get = "GET" |