diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-25 20:01:58 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-25 20:01:58 -0200 |
commit | f84ffdd5dee019941b695891f31a07c5c28a3346 (patch) | |
tree | ea431fbf1ac8c138717ab0c3772836a313d226e9 | |
parent | 25c85cb6f6d8715da3f7fae08b165d01e6b34348 (diff) | |
parent | 1d85c707b633b6ed1623290fa9aff5d7fd74d05e (diff) | |
download | rails-f84ffdd5dee019941b695891f31a07c5c28a3346.tar.gz rails-f84ffdd5dee019941b695891f31a07c5c28a3346.tar.bz2 rails-f84ffdd5dee019941b695891f31a07c5c28a3346.zip |
Merge pull request #17733 from yuki24/do-not-rescue-exception-in-params-parser
Do not rescue Exception in ActionDispatch::ParamsParser
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/params_parser.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/webservice_test.rb | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index b426183488..29d43faeed 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -47,7 +47,7 @@ module ActionDispatch 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) diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index d80b0e2da0..2b109ff19e 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -83,6 +83,16 @@ class WebServiceTest < ActionDispatch::IntegrationTest 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 |