提交 ad311f21 编写于 作者: A Aaron Patterson

remove hard coded regular expression

上级 c3284e2a
...@@ -112,6 +112,10 @@ def ip ...@@ -112,6 +112,10 @@ def ip
constraints[:ip] || // constraints[:ip] || //
end end
def requires_matching_verb?
constraints[:request_method]
end
def verb def verb
constraints[:request_method] || // constraints[:request_method] || //
end end
......
...@@ -120,7 +120,7 @@ def find_routes req ...@@ -120,7 +120,7 @@ def find_routes req
end end
def match_head_routes(routes, req) def match_head_routes(routes, req)
verb_specific_routes = routes.reject { |route| route.verb == // } verb_specific_routes = routes.select(&:requires_matching_verb?)
head_routes = match_routes(verb_specific_routes, req) head_routes = match_routes(verb_specific_routes, req)
if head_routes.empty? if head_routes.empty?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册