From 3efb0bcdafc524cbbb002455b9bbc1233e43a868 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 11:19:04 -0700 Subject: move parameter parsing to the request object All parameter parsing should be on the request object because the request object is the object that we ask for parameters. --- actionpack/lib/action_dispatch/http/request.rb | 35 +++++++++++++++++++++- .../action_dispatch/middleware/params_parser.rb | 24 ++------------- 2 files changed, 37 insertions(+), 22 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index b2566c4820..68a8ca707a 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -348,13 +348,29 @@ module ActionDispatch # Override Rack's POST method to support indifferent access def POST fetch_header("action_dispatch.request.request_parameters") do - self.request_parameters = Request::Utils.normalize_encode_params(super || {}) + default = ->() { + Request::Utils.normalize_encode_params(super || {}) + } + pr = parse_formatted_parameters(self, params_parsers, default) do |params| + params + end + self.request_parameters = pr end rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e raise ActionController::BadRequest.new(:request, e) end alias :request_parameters :POST + def params_parsers + fetch_header "action_dispatch.request.params_parsers" do + {} + end + end + + def params_parsers= hash + set_header "action_dispatch.request.params_parsers", hash + end + # Returns the authorization header regardless of whether it was specified directly or through one of the # proxy alternatives. def authorization @@ -383,5 +399,22 @@ module ActionDispatch HTTP_METHOD_LOOKUP[name] || raise(ActionController::UnknownHttpMethod, "#{name}, accepted HTTP methods are #{HTTP_METHODS[0...-1].join(', ')}, and #{HTTP_METHODS[-1]}") name end + + def parse_formatted_parameters(request, parsers, default = ->() { nil }) + return default.call if request.content_length.zero? + + strategy = parsers.fetch(request.content_mime_type) { return default.call } + + yield strategy.call(request.raw_post) + + rescue Rack::QueryParser::InvalidParameterError + raise + rescue => e # JSON or Ruby code block errors + my_logger = logger || ActiveSupport::Logger.new($stderr) + my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" + request.request_parameters = {} + + raise ParamsParser::ParseError.new(e.message, e) + end end end diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 9cde9c9b98..a658a414a5 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -37,29 +37,11 @@ module ActionDispatch def call(env) request = Request.new(env) - parse_formatted_parameters(request, @parsers) do |params| - request.request_parameters = params - end + request.params_parsers = @parsers + + request.request_parameters @app.call(env) end - - private - def parse_formatted_parameters(request, parsers) - return if request.content_length.zero? - - strategy = parsers.fetch(request.content_mime_type) { return nil } - - yield strategy.call(request.raw_post) - - rescue => e # JSON or Ruby code block errors - logger(request).debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" - - raise ParseError.new(e.message, e) - end - - def logger(request) - request.logger || ActiveSupport::Logger.new($stderr) - end end end -- cgit v1.2.3 From 93a391e7863102a77991fc019bb5b9b4158ec759 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 11:24:13 -0700 Subject: remove the `default` parameter from the parser method since there is only one "default" strategy now, we can just use the block parameter for that. --- actionpack/lib/action_dispatch/http/request.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 68a8ca707a..232006895f 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -348,11 +348,8 @@ module ActionDispatch # Override Rack's POST method to support indifferent access def POST fetch_header("action_dispatch.request.request_parameters") do - default = ->() { + pr = parse_formatted_parameters(self, params_parsers) do |params| Request::Utils.normalize_encode_params(super || {}) - } - pr = parse_formatted_parameters(self, params_parsers, default) do |params| - params end self.request_parameters = pr end @@ -400,12 +397,12 @@ module ActionDispatch name end - def parse_formatted_parameters(request, parsers, default = ->() { nil }) - return default.call if request.content_length.zero? + def parse_formatted_parameters(request, parsers) + return yield if request.content_length.zero? - strategy = parsers.fetch(request.content_mime_type) { return default.call } + strategy = parsers.fetch(request.content_mime_type) { return yield } - yield strategy.call(request.raw_post) + strategy.call(request.raw_post) rescue Rack::QueryParser::InvalidParameterError raise -- cgit v1.2.3 From 73396238e7218d3697884234fce74e604450bf4f Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 11:26:15 -0700 Subject: pull `normalize_encode_params` up `normalize_encode_params` is common to all parser code paths, so we can pull that up and always apply it before assigning the request parameters --- actionpack/lib/action_dispatch/http/request.rb | 4 ++-- actionpack/lib/action_dispatch/middleware/params_parser.rb | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 232006895f..148ab7c3b8 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -349,9 +349,9 @@ module ActionDispatch def POST fetch_header("action_dispatch.request.request_parameters") do pr = parse_formatted_parameters(self, params_parsers) do |params| - Request::Utils.normalize_encode_params(super || {}) + super || {} end - self.request_parameters = pr + self.request_parameters = Request::Utils.normalize_encode_params(pr) end rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e raise ActionController::BadRequest.new(:request, e) diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index a658a414a5..17524129d4 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -21,8 +21,7 @@ module ActionDispatch DEFAULT_PARSERS = { Mime::JSON => lambda { |raw_post| data = ActiveSupport::JSON.decode(raw_post) - data = {:_json => data} unless data.is_a?(Hash) - Request::Utils.normalize_encode_params(data) + data.is_a?(Hash) ? data : {:_json => data} } } -- cgit v1.2.3 From 1555ae9be1a74a869e4b238e00b820799dab8218 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 11:34:54 -0700 Subject: only wrap the strategy with exception handling we need to be more specific about exception handling when dealing with the parse strategies. The calls to `return yield` can also raise an exception, but we don't want to handle that in *this* code. --- actionpack/lib/action_dispatch/http/request.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 148ab7c3b8..ea083425ba 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -353,6 +353,9 @@ module ActionDispatch end self.request_parameters = Request::Utils.normalize_encode_params(pr) end + rescue ParamsParser::ParseError # one of the parse strategies blew up + self.request_parameters = Request::Utils.normalize_encode_params(super || {}) + raise rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e raise ActionController::BadRequest.new(:request, e) end @@ -402,16 +405,14 @@ module ActionDispatch strategy = parsers.fetch(request.content_mime_type) { return yield } - strategy.call(request.raw_post) - - rescue Rack::QueryParser::InvalidParameterError - raise - rescue => e # JSON or Ruby code block errors - my_logger = logger || ActiveSupport::Logger.new($stderr) - my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" - request.request_parameters = {} + begin + strategy.call(request.raw_post) + rescue => e # JSON or Ruby code block errors + my_logger = logger || ActiveSupport::Logger.new($stderr) + my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" - raise ParamsParser::ParseError.new(e.message, e) + raise ParamsParser::ParseError.new(e.message, e) + end end end end -- cgit v1.2.3 From 91d05082e43008f2617d468fdd6c0de95855fe7f Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 11:37:02 -0700 Subject: stop eagerly parsing parameters Parameters will not be parsed until they are specifically requested via the `request_parameters` method. --- actionpack/lib/action_dispatch/middleware/params_parser.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 17524129d4..00c3324b06 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -38,8 +38,6 @@ module ActionDispatch request.params_parsers = @parsers - request.request_parameters - @app.call(env) end end -- cgit v1.2.3 From b93c226d19615fe504f9e12d6c0ee2d70683e5fa Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 11:46:51 -0700 Subject: push the parameter parsers on to the class The middleware stack is a singleton in the application (one instance is shared for the entire application) which means that there was only one opportunity to set the parameter parsers. Since there is only one set of parameter parsers in an app, lets just configure them on the request class (since that is where they are used). --- actionpack/lib/action_dispatch/http/parameters.rb | 35 ++++++++++++++++++++++ actionpack/lib/action_dispatch/http/request.rb | 25 ---------------- .../action_dispatch/middleware/params_parser.rb | 14 ++------- 3 files changed, 37 insertions(+), 37 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index 3c9f8cd9e4..3867e514a2 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -3,6 +3,20 @@ module ActionDispatch module Parameters PARAMETERS_KEY = 'action_dispatch.request.path_parameters' + DEFAULT_PARSERS = { + Mime::JSON => lambda { |raw_post| + data = ActiveSupport::JSON.decode(raw_post) + data.is_a?(Hash) ? data : {:_json => data} + } + } + + def self.included(klass) + class << klass + attr_accessor :parameter_parsers + end + + klass.parameter_parsers = DEFAULT_PARSERS + end # Returns both GET and POST \parameters in a single hash. def parameters params = get_header("action_dispatch.request.parameters") @@ -31,6 +45,27 @@ module ActionDispatch def path_parameters get_header(PARAMETERS_KEY) || {} end + + private + + def parse_formatted_parameters(request, parsers) + return yield if request.content_length.zero? + + strategy = parsers.fetch(request.content_mime_type) { return yield } + + begin + strategy.call(request.raw_post) + rescue => e # JSON or Ruby code block errors + my_logger = logger || ActiveSupport::Logger.new($stderr) + my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" + + raise ParamsParser::ParseError.new(e.message, e) + end + end + + def params_parsers + ActionDispatch::Request.parameter_parsers + end end end end diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index ea083425ba..cb59510613 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -361,16 +361,6 @@ module ActionDispatch end alias :request_parameters :POST - def params_parsers - fetch_header "action_dispatch.request.params_parsers" do - {} - end - end - - def params_parsers= hash - set_header "action_dispatch.request.params_parsers", hash - end - # Returns the authorization header regardless of whether it was specified directly or through one of the # proxy alternatives. def authorization @@ -399,20 +389,5 @@ module ActionDispatch HTTP_METHOD_LOOKUP[name] || raise(ActionController::UnknownHttpMethod, "#{name}, accepted HTTP methods are #{HTTP_METHODS[0...-1].join(', ')}, and #{HTTP_METHODS[-1]}") name end - - def parse_formatted_parameters(request, parsers) - return yield if request.content_length.zero? - - strategy = parsers.fetch(request.content_mime_type) { return yield } - - begin - strategy.call(request.raw_post) - rescue => e # JSON or Ruby code block errors - my_logger = logger || ActiveSupport::Logger.new($stderr) - my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" - - raise ParamsParser::ParseError.new(e.message, e) - end - end end end diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 00c3324b06..ef55401015 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -18,26 +18,16 @@ module ActionDispatch end end - DEFAULT_PARSERS = { - Mime::JSON => lambda { |raw_post| - data = ActiveSupport::JSON.decode(raw_post) - data.is_a?(Hash) ? data : {:_json => data} - } - } - # Create a new +ParamsParser+ middleware instance. # # The +parsers+ argument can take Hash of parsers where key is identifying # content mime type, and value is a lambda that is going to process data. def initialize(app, parsers = {}) - @app, @parsers = app, DEFAULT_PARSERS.merge(parsers) + @app = app + ActionDispatch::Request.parameter_parsers = ActionDispatch::Request::DEFAULT_PARSERS.merge(parsers) end def call(env) - request = Request.new(env) - - request.params_parsers = @parsers - @app.call(env) end end -- cgit v1.2.3 From a1ced8b52ce60d0634e65aa36cb89f015f9f543d Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 13:03:07 -0700 Subject: do not instantiate a param parser middleware we don't actually need a param parser middleware instance since the request object will take care of parsing parameters for us. For now, we'll just configure the parameter parsers on the request in this class. --- .../lib/action_dispatch/middleware/params_parser.rb | 8 ++------ actionpack/test/controller/webservice_test.rb | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index ef55401015..18af0a583a 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -22,13 +22,9 @@ module ActionDispatch # # The +parsers+ argument can take Hash of parsers where key is identifying # content mime type, and value is a lambda that is going to process data. - def initialize(app, parsers = {}) - @app = app + def self.new(app, parsers = {}) ActionDispatch::Request.parameter_parsers = ActionDispatch::Request::DEFAULT_PARSERS.merge(parsers) - end - - def call(env) - @app.call(env) + app end end end diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index b26f037c36..8b37c9599e 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -97,24 +97,28 @@ class WebServiceTest < ActionDispatch::IntegrationTest end def test_parsing_json_doesnot_rescue_exception - with_test_route_set do - with_params_parsers Mime::JSON => Proc.new { |data| raise Interrupt } do - assert_raises(Interrupt) do - post "/", - params: '{"title":"JSON"}}', - headers: { 'CONTENT_TYPE' => 'application/json' } - end + req = Class.new(ActionDispatch::Request) do + def params_parsers + { Mime::JSON => Proc.new { |data| raise Interrupt } } end + + def content_length; get_header('rack.input').length; end + end.new({ 'rack.input' => StringIO.new('{"title":"JSON"}}'), 'CONTENT_TYPE' => 'application/json' }) + + assert_raises(Interrupt) do + req.request_parameters end end private def with_params_parsers(parsers = {}) old_session = @integration_session - @app = ActionDispatch::ParamsParser.new(app.routes, parsers) + original_parsers = ActionDispatch::Request.parameter_parsers + ActionDispatch::Request.parameter_parsers = original_parsers.merge parsers reset! yield ensure + ActionDispatch::Request.parameter_parsers = original_parsers @integration_session = old_session end -- cgit v1.2.3 From 8db2e67c0ab5560314a8e26d93e5fa1eeda5a1fa Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 13:05:01 -0700 Subject: remove the request parameter from `parse_formatted_parameters` This is an instance method on the request object now so we don't need it anymore --- actionpack/lib/action_dispatch/http/parameters.rb | 10 +++++----- actionpack/lib/action_dispatch/http/request.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index 3867e514a2..27fadb708e 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -48,16 +48,16 @@ module ActionDispatch private - def parse_formatted_parameters(request, parsers) - return yield if request.content_length.zero? + def parse_formatted_parameters(parsers) + return yield if content_length.zero? - strategy = parsers.fetch(request.content_mime_type) { return yield } + strategy = parsers.fetch(content_mime_type) { return yield } begin - strategy.call(request.raw_post) + strategy.call(raw_post) rescue => e # JSON or Ruby code block errors my_logger = logger || ActiveSupport::Logger.new($stderr) - my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}" + my_logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{raw_post}" raise ParamsParser::ParseError.new(e.message, e) end diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index cb59510613..eaa7e88b34 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -348,7 +348,7 @@ module ActionDispatch # Override Rack's POST method to support indifferent access def POST fetch_header("action_dispatch.request.request_parameters") do - pr = parse_formatted_parameters(self, params_parsers) do |params| + pr = parse_formatted_parameters(params_parsers) do |params| super || {} end self.request_parameters = Request::Utils.normalize_encode_params(pr) -- cgit v1.2.3 From 05b08f295251583cb6ac51ed0075e5d77fdd830c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 13:52:30 -0700 Subject: remove setting request parameters for JSON requests The request object will automatically parse these in the `parse_formatted_parameters` method, so we don't have to worry about it. --- actionpack/lib/action_controller/test_case.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index fbbaa1a887..c2f07b2373 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -83,8 +83,6 @@ module ActionController raise "Unknown Content-Type: #{content_type}" when :json data = ActiveSupport::JSON.encode(non_path_parameters) - params = ActiveSupport::JSON.decode(data).with_indifferent_access - self.request_parameters = params when :xml data = non_path_parameters.to_xml params = Hash.from_xml(data)['hash'] -- cgit v1.2.3 From b8b7664415f9d6668156280a8ed051dc04786115 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 14:32:20 -0700 Subject: let the request object handle parsing XML posts The test request object will handle parsing XML posts now, so we don't need to eagerly parse them in the test harness --- actionpack/lib/action_controller/test_case.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index c2f07b2373..c360cfd542 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -33,6 +33,9 @@ module ActionController self.session = session self.session_options = TestSession::DEFAULT_OPTIONS + @custom_param_parsers = { + Mime::XML => lambda { |raw_post| Hash.from_xml(raw_post)['hash'] } + } end def query_string=(string) @@ -85,8 +88,6 @@ module ActionController data = ActiveSupport::JSON.encode(non_path_parameters) when :xml data = non_path_parameters.to_xml - params = Hash.from_xml(data)['hash'] - self.request_parameters = params when :url_encoded_form data = non_path_parameters.to_query else @@ -134,6 +135,12 @@ module ActionController "multipart/form-data; boundary=#{Rack::Test::MULTIPART_BOUNDARY}" end end.new + + private + + def params_parsers + super.merge @custom_param_parsers + end end class LiveTestResponse < Live::Response -- cgit v1.2.3 From d14d41282e90c5e32edeeda79014a2f83b907b73 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 14:34:09 -0700 Subject: all parameter parsing is done through the request object now. --- actionpack/lib/action_controller/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index c360cfd542..869f8e432b 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -91,8 +91,8 @@ module ActionController when :url_encoded_form data = non_path_parameters.to_query else + @custom_param_parsers[content_mime_type] = ->(_) { non_path_parameters } data = non_path_parameters.to_query - self.request_parameters = non_path_parameters end end -- cgit v1.2.3 From 58dba19a0b0e4f71927b3262970f0d5dcb8990ea Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 18 Sep 2015 14:34:42 -0700 Subject: remove outdated comment all parameter parsing is done on the request object now, so we don't need to worry about at ParamParser middleware --- actionpack/lib/action_controller/test_case.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 869f8e432b..f16c851456 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -77,10 +77,6 @@ module ActionController set_header k, 'application/x-www-form-urlencoded' end - # FIXME: setting `request_parametes` is normally handled by the - # params parser middleware, and we should remove this roundtripping - # when we switch to caling `call` on the controller - case content_mime_type.to_sym when nil raise "Unknown Content-Type: #{content_type}" -- cgit v1.2.3