提交 5c07e1a3 编写于 作者: A Akira Matsuda

Reduce Hash allocations

Merging multiple Hashes in Ruby < 2.6 is so hard...
上级 a221ee84
......@@ -40,11 +40,12 @@ def serve(req)
req.path_info = "/" + req.path_info unless req.path_info.start_with? "/"
end
parameters = route.defaults.merge parameters.each_value { |val|
val.force_encoding(::Encoding::UTF_8)
tmp_params = set_params.merge route.defaults
parameters.each_pair { |key, val|
tmp_params[key] = val.force_encoding(::Encoding::UTF_8)
}
req.path_parameters = set_params.merge parameters
req.path_parameters = tmp_params
status, headers, body = route.app.serve(req)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册