diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-05-07 12:19:42 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2019-05-07 15:14:14 -0400 |
commit | d155f61b64e7cecc56fe6281d084e1b12a0a3584 (patch) | |
tree | af546f7fb3d7dfe9d511a26ae823203a5857d704 /actionpack/test | |
parent | 68dc8c450067ff83455e1997c9330088cfce5fa0 (diff) | |
download | rails-d155f61b64e7cecc56fe6281d084e1b12a0a3584.tar.gz rails-d155f61b64e7cecc56fe6281d084e1b12a0a3584.tar.bz2 rails-d155f61b64e7cecc56fe6281d084e1b12a0a3584.zip |
Merge pull request #36196 from st0012/fix-29947
Hide malformed parameters from error page
Accidentally merged this to 6-0-stable so forward porting it to master
here instead.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/debug_exceptions_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb index 5ae8a20ae4..3e57e8f4d9 100644 --- a/actionpack/test/dispatch/debug_exceptions_test.rb +++ b/actionpack/test/dispatch/debug_exceptions_test.rb @@ -620,4 +620,23 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest assert_select 'input[value="Action 2"]' end end + + test "debug exceptions app shows diagnostics when malformed query parameters are provided" do + @app = DevelopmentApp + + get "/bad_request?x[y]=1&x[y][][w]=2" + + assert_response 400 + assert_match "ActionController::BadRequest", body + end + + test "debug exceptions app shows diagnostics when malformed query parameters are provided by XHR" do + @app = DevelopmentApp + xhr_request_env = { "action_dispatch.show_exceptions" => true, "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest" } + + get "/bad_request?x[y]=1&x[y][][w]=2", headers: xhr_request_env + + assert_response 400 + assert_match "ActionController::BadRequest", body + end end |