Permalink
Browse files

Merge pull request #15321 from tgxworld/only_find_routes_as_heads_for…

…_head_request

Call get_routes_as_head only on HEAD requests.
  • Loading branch information...
spastorino committed May 27, 2014
2 parents 0bef6ff + 15df2a3 commit 6f9aff75a5e8cdfb92e425e433807ac2972df740
Showing with 4 additions and 1 deletion.
  1. +4 −1 actionpack/lib/action_dispatch/journey/router.rb
@@ -99,7 +99,10 @@ def find_routes req
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) }

0 comments on commit 6f9aff7

Please sign in to comment.