提交 fa216dc3 编写于 作者: M Marcin Olichwirowicz

Code cleanup

Cleanup for `ActionDispatch::Http::Parameters` - no need for required libraries
and remove not used private method.

Apparently this method was used in `ActionDispatch::Http::Request` - fixed
by calling `Request::Utils` explicitly (as was done in other parts of the codebase)
上级 c967c5eb
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/indifferent_access'
module ActionDispatch
module Http
module Parameters
......@@ -34,14 +31,6 @@ def path_parameters=(parameters) #:nodoc:
def path_parameters
get_header(PARAMETERS_KEY) || {}
end
private
# Convert nested Hash to HashWithIndifferentAccess.
#
def normalize_encode_params(params)
ActionDispatch::Request::Utils.normalize_encode_params params
end
end
end
end
......@@ -332,7 +332,7 @@ def session_options=(options)
# Override Rack's GET method to support indifferent access
def GET
get_header("action_dispatch.request.query_parameters") do |k|
set_header k, normalize_encode_params(super || {})
set_header k, Request::Utils.normalize_encode_params(super || {})
end
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
raise ActionController::BadRequest.new(:query, e)
......@@ -342,7 +342,7 @@ def GET
# Override Rack's POST method to support indifferent access
def POST
get_header("action_dispatch.request.request_parameters") do
self.request_parameters = normalize_encode_params(super || {})
self.request_parameters = Request::Utils.normalize_encode_params(super || {})
end
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
raise ActionController::BadRequest.new(:request, e)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册