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

Merge pull request #31642 from fatkodima/metal-action-duplication

Remove code duplication for `ActionController::Metal.action`
......@@ -230,18 +230,16 @@ def self.middleware
# Returns a Rack endpoint for the given action name.
def self.action(name)
app = lambda { |env|
req = ActionDispatch::Request.new(env)
res = make_response! req
new.dispatch(name, req, res)
}
if middleware_stack.any?
middleware_stack.build(name) do |env|
req = ActionDispatch::Request.new(env)
res = make_response! req
new.dispatch(name, req, res)
end
middleware_stack.build(name, app)
else
lambda { |env|
req = ActionDispatch::Request.new(env)
res = make_response! req
new.dispatch(name, req, res)
}
app
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册