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
end
params.merge!(path_parameters)
params.with_indifferent_access
end
end
alias :params :parameters

View file

@ -280,7 +280,7 @@ module ActionDispatch
# Override Rack's GET method to support indifferent access
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
raise ActionController::BadRequest.new(:query, e)
end
@ -288,7 +288,7 @@ module ActionDispatch
# Override Rack's POST method to support indifferent access
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
raise ActionController::BadRequest.new(:request, e)
end

View file

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