diff options
author | Jeremy Kemper <jeremykemper@gmail.com> | 2015-02-24 15:59:00 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremykemper@gmail.com> | 2015-02-24 15:59:21 -0700 |
commit | f4f94081dd1a3e9ff99e17ae88b7d91fcdbb19fc (patch) | |
tree | 3c00904e4a1caecf4121a7bd5a6a570ec17a8ab6 | |
parent | 803ef74f9bbcbc71af12060157a996f7b65e24db (diff) | |
download | rails-f4f94081dd1a3e9ff99e17ae88b7d91fcdbb19fc.tar.gz rails-f4f94081dd1a3e9ff99e17ae88b7d91fcdbb19fc.tar.bz2 rails-f4f94081dd1a3e9ff99e17ae88b7d91fcdbb19fc.zip |
Add a failing test demonstrating regression with HEAD requests to Rack apps, re #18764
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index deb289bd57..d65d2e8e8f 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -3489,13 +3489,19 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest def test_head_fetch_with_mount_on_root draw do get '/home' => 'test#index' - mount lambda { |env| [404, {"Content-Type" => "text/html"}, ["testing"]] }, at: '/' + mount lambda { |env| [200, {}, [env['REQUEST_METHOD']]] }, at: '/' end + + # HEAD request matches `get /home` rather than the lower-precedence + # Rack app mounted at `/` head '/home' assert_response :success + assert_equal 'test#index', @response.body - head '/' - assert_response :not_found + # But the Rack app can still respond to its own HEAD requests. + head '/foobar' + assert_response :ok + assert_equal 'HEAD', @response.body end private |