diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2014-08-21 10:08:48 +0100 |
---|---|---|
committer | Andrew White <pixeltrix@users.noreply.github.com> | 2014-08-21 10:08:48 +0100 |
commit | 93606e5937e353244cb70f787c02b63bdca8ea19 (patch) | |
tree | 3273b0fa45fb07c43cdefb3cd08c840b0edd241d /actionpack/test/dispatch | |
parent | d3b0bb28ba4cf8c7043546349f932ef2dd98ff04 (diff) | |
parent | 92120426317083ae90cb64cff07a7dd3a8acdc65 (diff) | |
download | rails-93606e5937e353244cb70f787c02b63bdca8ea19.tar.gz rails-93606e5937e353244cb70f787c02b63bdca8ea19.tar.bz2 rails-93606e5937e353244cb70f787c02b63bdca8ea19.zip |
Merge pull request #15443 from tgxworld/preload_head_routes
Map HEAD requests to GET routes instead of duplicating GET routes.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/request_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 84bd392fd9..00b80c7357 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -650,6 +650,18 @@ class RequestMethod < BaseRequestTest end end + test "allow request method hacking" do + request = stub_request('REQUEST_METHOD' => 'POST') + + assert_equal 'POST', request.request_method + assert_equal 'POST', request.env["REQUEST_METHOD"] + + request.request_method = 'GET' + + assert_equal 'GET', request.request_method + assert_equal 'GET', request.env["REQUEST_METHOD"] + end + test "invalid http method raises exception" do assert_raise(ActionController::UnknownHttpMethod) do stub_request('REQUEST_METHOD' => 'RANDOM_METHOD').request_method |