class ActionDispatch::Journey::Router

def match_head_routes(routes, req)

def match_head_routes(routes, req)
  head_routes = match_routes(routes, req)
  if head_routes.empty?
    begin
      req.request_method = "GET"
      match_routes(routes, req)
    ensure
      req.request_method = "HEAD"
    end
  else
    head_routes
  end
end