未验证 提交 c7620bb9 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #38914 from jasonhl/less-path-info

Reduce calls to get path info when finding routes
......@@ -106,8 +106,9 @@ def filter_routes(path)
end
def find_routes(req)
routes = filter_routes(req.path_info).concat custom_routes.find_all { |r|
r.path.match?(req.path_info)
path_info = req.path_info
routes = filter_routes(path_info).concat custom_routes.find_all { |r|
r.path.match?(path_info)
}
if req.head?
......@@ -119,7 +120,7 @@ def find_routes(req)
routes.sort_by!(&:precedence)
routes.map! { |r|
match_data = r.path.match(req.path_info)
match_data = r.path.match(path_info)
path_parameters = {}
match_data.names.each_with_index { |name, i|
val = match_data[i + 1]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册