aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/params_parser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/params_parser.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/params_parser.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb
index ff2b2fe74b..32ccb5c931 100644
--- a/actionpack/lib/action_dispatch/middleware/params_parser.rb
+++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb
@@ -2,11 +2,13 @@ require 'active_support/json'
module ActionDispatch
class ParamsParser
- ActionController::Base.param_parsers[Mime::XML] = :xml_simple
- ActionController::Base.param_parsers[Mime::JSON] = :json
+ DEFAULT_PARSERS = {
+ Mime::XML => :xml_simple,
+ Mime::JSON => :json
+ }
- def initialize(app)
- @app = app
+ def initialize(app, parsers = {})
+ @app, @parsers = app, DEFAULT_PARSERS.merge(parsers)
end
def call(env)
@@ -24,7 +26,7 @@ module ActionDispatch
return false if request.content_length.zero?
mime_type = content_type_from_legacy_post_data_format_header(env) || request.content_type
- strategy = ActionController::Base.param_parsers[mime_type]
+ strategy = @parsers[mime_type]
return false unless strategy