aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
diff options
context:
space:
mode:
authorSebastian Sogamoso <sebasoga@gmail.com>2013-03-11 08:00:19 -0500
committerSebastian Sogamoso <sebasoga@gmail.com>2013-03-11 09:28:22 -0500
commitb3f894c5282244b41221f98dfac5296cea5a4485 (patch)
tree6408e5e79c0d101607590262d7746339f5a44e5b /actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
parent6e5ab6fccb55727ef2e32c30a77a48c595316cae (diff)
downloadrails-b3f894c5282244b41221f98dfac5296cea5a4485.tar.gz
rails-b3f894c5282244b41221f98dfac5296cea5a4485.tar.bz2
rails-b3f894c5282244b41221f98dfac5296cea5a4485.zip
Change ActionController::Parameters#require behavior when value is empty
When the value for the required key is empty an ActionController::ParameterMissing is raised which gets caught by ActionController::Base and turned into a 400 Bad Request reply with a message in the body saying the key is missing, which is misleading. With these changes, ActionController::EmptyParameter will be raised which ActionController::Base will catch and turn into a 400 Bad Request reply with a message in the body saying the key value is empty.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/exception_wrapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/exception_wrapper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
index 7489ce8028..af32a1f9d7 100644
--- a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
+++ b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
@@ -13,7 +13,8 @@ module ActionDispatch
'ActionController::UnknownFormat' => :not_acceptable,
'ActionController::InvalidAuthenticityToken' => :unprocessable_entity,
'ActionController::BadRequest' => :bad_request,
- 'ActionController::ParameterMissing' => :bad_request
+ 'ActionController::ParameterMissing' => :bad_request,
+ 'ActionController::EmptyParameter' => :bad_request
)
cattr_accessor :rescue_templates