提交 f84ffdd5 编写于 作者: R Rafael Mendonça França

Merge pull request #17733 from yuki24/do-not-rescue-exception-in-params-parser

Do not rescue Exception in ActionDispatch::ParamsParser
......@@ -47,7 +47,7 @@ def parse_formatted_parameters(env)
else
false
end
rescue Exception => e # JSON or Ruby code block errors
rescue => e # JSON or Ruby code block errors
logger(env).debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}"
raise ParseError.new(e.message, e)
......
......@@ -83,6 +83,16 @@ def test_dasherized_keys_as_json
end
end
def test_parsing_json_doesnot_rescue_exception
with_test_route_set do
with_params_parsers Mime::JSON => Proc.new { |data| raise Interrupt } do
assert_raises(Interrupt) do
post "/", '{"title":"JSON"}}', 'CONTENT_TYPE' => 'application/json'
end
end
end
end
private
def with_params_parsers(parsers = {})
old_session = @integration_session
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册