aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb4
-rw-r--r--actionpack/lib/action_dispatch/middleware/params_parser.rb3
2 files changed, 3 insertions, 4 deletions
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}
}
}