aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2014-05-27 14:46:49 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2014-05-27 14:46:49 -0300
commit6f9aff75a5e8cdfb92e425e433807ac2972df740 (patch)
tree359a3ed6f85116835e17d1cc51f10b3495eb6de2 /actionpack/lib/action_dispatch/journey
parent0bef6ff9af6be8d0def825a09188697526f7dae2 (diff)
parent15df2a3c796832224c3d98091321895aa2641157 (diff)
downloadrails-6f9aff75a5e8cdfb92e425e433807ac2972df740.tar.gz
rails-6f9aff75a5e8cdfb92e425e433807ac2972df740.tar.bz2
rails-6f9aff75a5e8cdfb92e425e433807ac2972df740.zip
Merge pull request #15321 from tgxworld/only_find_routes_as_heads_for_head_request
Call get_routes_as_head only on HEAD requests.
Diffstat (limited to 'actionpack/lib/action_dispatch/journey')
-rw-r--r--actionpack/lib/action_dispatch/journey/router.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb
index c0317e3ad2..7e525d04d4 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) }