diff options
-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 |