From f4f94081dd1a3e9ff99e17ae88b7d91fcdbb19fc Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 24 Feb 2015 15:59:00 -0700 Subject: Add a failing test demonstrating regression with HEAD requests to Rack apps, re #18764 --- actionpack/test/dispatch/routing_test.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'actionpack') 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 -- cgit v1.2.3