From d3eb92d95a694905a80668dcde1fb49e2d08f388 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 3 Jul 2014 21:32:14 -0700 Subject: Avoid duplicating routes for HEAD requests. Follow up to rails#15321 Instead of duplicating the routes, we will first match the HEAD request to HEAD routes. If no match is found, we will then map the HEAD request to GET routes. --- actionpack/lib/action_dispatch/http/request.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/lib/action_dispatch/http') diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index f35289253b..c441f7f95b 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -105,6 +105,12 @@ module ActionDispatch @request_method ||= check_method(env["REQUEST_METHOD"]) end + def request_method=(request_method) #:nodoc: + if check_method(request_method) + @request_method = env["REQUEST_METHOD"] = request_method + end + end + # Returns a symbol form of the #request_method def request_method_symbol HTTP_METHOD_LOOKUP[request_method] -- cgit v1.2.3