提交 93956a18 编写于 作者: J Joshua Peek

Only send filtered_env for notifications

上级 87bcf1aa
......@@ -9,7 +9,9 @@ def initialize(app)
end
def call(env)
payload = retrieve_payload_from_env(env)
request = Request.new(env)
payload = retrieve_payload_from_env(request.filter_env)
ActiveSupport::Notifications.instrument("action_dispatch.before_dispatch", payload)
ActiveSupport::Notifications.instrument!("action_dispatch.after_dispatch", payload) do
......@@ -21,11 +23,10 @@ def call(env)
raise exception
end
protected
# Remove any rack related constants from the env, like rack.input.
def retrieve_payload_from_env(env)
Hash[:env => env.except(*env.keys.select { |k| k.to_s.index("rack.") == 0 })]
end
protected
# Remove any rack related constants from the env, like rack.input.
def retrieve_payload_from_env(env)
Hash[:env => env.except(*env.keys.select { |k| k.to_s.index("rack.") == 0 })]
end
end
end
\ No newline at end of file
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册