From b58acea5696c777ae828d7866fcff334d493b4d3 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Fri, 21 Aug 2009 16:49:33 -0500 Subject: Move legacy param_parsers config onto AD::ParamsParser --- actionpack/lib/action_dispatch/middleware/params_parser.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_dispatch/middleware/params_parser.rb') 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 -- cgit v1.2.3