1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove duplicated HashWithIndifferentAccess#with_indifferent_access.

This commit is contained in:
Guo Xiang Tan 2014-05-26 12:50:44 -07:00
parent 6c30717f8c
commit 223e118a3c
3 changed files with 3 additions and 7 deletions

View file

@ -18,7 +18,6 @@ module ActionDispatch
query_parameters.dup query_parameters.dup
end end
params.merge!(path_parameters) params.merge!(path_parameters)
params.with_indifferent_access
end end
end end
alias :params :parameters alias :params :parameters

View file

@ -280,7 +280,7 @@ module ActionDispatch
# Override Rack's GET method to support indifferent access # Override Rack's GET method to support indifferent access
def GET def GET
@env["action_dispatch.request.query_parameters"] ||= Utils.deep_munge((normalize_encode_params(super) || {})) @env["action_dispatch.request.query_parameters"] ||= Utils.deep_munge(normalize_encode_params(super || {}))
rescue TypeError => e rescue TypeError => e
raise ActionController::BadRequest.new(:query, e) raise ActionController::BadRequest.new(:query, e)
end end
@ -288,7 +288,7 @@ module ActionDispatch
# Override Rack's POST method to support indifferent access # Override Rack's POST method to support indifferent access
def POST def POST
@env["action_dispatch.request.request_parameters"] ||= Utils.deep_munge((normalize_encode_params(super) || {})) @env["action_dispatch.request.request_parameters"] ||= Utils.deep_munge(normalize_encode_params(super || {}))
rescue TypeError => e rescue TypeError => e
raise ActionController::BadRequest.new(:request, e) raise ActionController::BadRequest.new(:request, e)
end end

View file

@ -130,10 +130,7 @@ class UrlEncodedParamsParsingTest < ActionDispatch::IntegrationTest
end end
test "ambiguous params returns a bad request" do test "ambiguous params returns a bad request" do
with_routing do |set| with_test_routing do
set.draw do
post ':action', to: ::UrlEncodedParamsParsingTest::TestController
end
post "/parse", "foo[]=bar&foo[4]=bar" post "/parse", "foo[]=bar&foo[4]=bar"
assert_response :bad_request assert_response :bad_request
end end