From 15df2a3c796832224c3d98091321895aa2641157 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Sun, 25 May 2014 13:48:30 -0700 Subject: Call get_routes_as_head only on HEAD requests. --- actionpack/lib/action_dispatch/journey/router.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index 2ead6a4eb3..d501b4df00 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -99,7 +99,10 @@ module ActionDispatch routes = filter_routes(req.path_info).concat custom_routes.find_all { |r| r.path.match(req.path_info) } - routes.concat get_routes_as_head(routes) + + if req.env["REQUEST_METHOD"] === "HEAD" + routes.concat get_routes_as_head(routes) + end routes.sort_by!(&:precedence).select! { |r| r.matches?(req) } -- cgit v1.2.3