class ActionDispatch::Journey::Router

def match_head_routes(routes, req)

def match_head_routes(routes, req)
  head_routes = routes.select { |r| r.requires_matching_verb? && r.matches?(req) }
  return head_routes unless head_routes.empty?
  begin
    req.request_method = "GET"
    routes.select! { |r| r.matches?(req) }
    routes
  ensure
    req.request_method = "HEAD"
  end
end