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