aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Melentiev <melentievm@gmail.com>2014-10-14 18:51:23 +0300
committerMax Melentiev <melentievm@gmail.com>2014-10-14 18:56:51 +0300
commit7a7ccc31e7d883c8e5c5fed91c1cea2fbe32f6c9 (patch)
treecd0c94fd73e15737b718423bb64be425f5d05b59
parent5a5073301c66b7999ad25c18a22d44922002c689 (diff)
downloadrails-7a7ccc31e7d883c8e5c5fed91c1cea2fbe32f6c9.tar.gz
rails-7a7ccc31e7d883c8e5c5fed91c1cea2fbe32f6c9.tar.bz2
rails-7a7ccc31e7d883c8e5c5fed91c1cea2fbe32f6c9.zip
ActionController::InvalidCrossOriginRequest fails with 422 instead of 500
Fixes #15967
-rw-r--r--actionpack/lib/action_dispatch/middleware/exception_wrapper.rb21
1 files changed, 11 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
index b98b553c38..a6285848b5 100644
--- a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
+++ b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb
@@ -6,16 +6,17 @@ module ActionDispatch
cattr_accessor :rescue_responses
@@rescue_responses = Hash.new(:internal_server_error)
@@rescue_responses.merge!(
- 'ActionController::RoutingError' => :not_found,
- 'AbstractController::ActionNotFound' => :not_found,
- 'ActionController::MethodNotAllowed' => :method_not_allowed,
- 'ActionController::UnknownHttpMethod' => :method_not_allowed,
- 'ActionController::NotImplemented' => :not_implemented,
- 'ActionController::UnknownFormat' => :not_acceptable,
- 'ActionController::InvalidAuthenticityToken' => :unprocessable_entity,
- 'ActionDispatch::ParamsParser::ParseError' => :bad_request,
- 'ActionController::BadRequest' => :bad_request,
- 'ActionController::ParameterMissing' => :bad_request
+ 'ActionController::RoutingError' => :not_found,
+ 'AbstractController::ActionNotFound' => :not_found,
+ 'ActionController::MethodNotAllowed' => :method_not_allowed,
+ 'ActionController::UnknownHttpMethod' => :method_not_allowed,
+ 'ActionController::NotImplemented' => :not_implemented,
+ 'ActionController::UnknownFormat' => :not_acceptable,
+ 'ActionController::InvalidAuthenticityToken' => :unprocessable_entity,
+ 'ActionController::InvalidCrossOriginRequest' => :unprocessable_entity,
+ 'ActionDispatch::ParamsParser::ParseError' => :bad_request,
+ 'ActionController::BadRequest' => :bad_request,
+ 'ActionController::ParameterMissing' => :bad_request
)
cattr_accessor :rescue_templates