diff options
author | Leonel Galan <leonelgalan@gmail.com> | 2017-02-13 18:14:41 -0500 |
---|---|---|
committer | Leonel Galan <leonelgalan@gmail.com> | 2017-02-13 18:24:40 -0500 |
commit | 7306fe362b665b4aed1dd9de4035af9dad7137a6 (patch) | |
tree | e933fa1a20da31d62a13413167a399e7d83d177f /actionpack/test/dispatch | |
parent | 2809f38ab8d75dabb5b053ac14f5e78a2ad802fa (diff) | |
download | rails-7306fe362b665b4aed1dd9de4035af9dad7137a6.tar.gz rails-7306fe362b665b4aed1dd9de4035af9dad7137a6.tar.bz2 rails-7306fe362b665b4aed1dd9de4035af9dad7137a6.zip |
Use of ParameterFilter no longer forces `request.filtered_parameters' class to be Hash
- Fixes issue described on #27944
- `filtered_query_string` used an Array representation of what
semantically is a key value pair: better suited for a Hash. Without
this change `filtered_params = original_params.class.new` returns an
Array with unintended consequences.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/request_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 2f9228a62d..baa4a0b3b4 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -1098,6 +1098,19 @@ class RequestParameterFilter < BaseRequestTest end end + test "parameter filter should maintain hash with indifferent access" do + test_hashes = [ + [{'foo'=>'bar'}.with_indifferent_access, %w'food'], + [{'foo'=>'bar'}.with_indifferent_access, []] + ] + + test_hashes.each do |before_filter, filter_words| + parameter_filter = ActionDispatch::Http::ParameterFilter.new(filter_words) + assert_instance_of ActiveSupport::HashWithIndifferentAccess, + parameter_filter.filter(before_filter) + end + end + test "filtered_parameters returns params filtered" do request = stub_request( "action_dispatch.request.parameters" => { |