diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-18 11:24:13 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-18 11:24:13 -0700 |
commit | 93a391e7863102a77991fc019bb5b9b4158ec759 (patch) | |
tree | c22e22a3f08c3a33466e952be2da8cbe061f4289 /actionpack | |
parent | 3efb0bcdafc524cbbb002455b9bbc1233e43a868 (diff) | |
download | rails-93a391e7863102a77991fc019bb5b9b4158ec759.tar.gz rails-93a391e7863102a77991fc019bb5b9b4158ec759.tar.bz2 rails-93a391e7863102a77991fc019bb5b9b4158ec759.zip |
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.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 13 |
1 files changed, 5 insertions, 8 deletions
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 |