diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2018-06-08 17:08:16 +0900 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2018-06-08 17:08:16 +0900 |
commit | e4e1b62007fe40c4277ebc30067837a91bf25967 (patch) | |
tree | 08a9299a13c9c3a3cd59488b330fb9884b24ded7 /actionpack/lib/action_controller | |
parent | 6cd5cc375a5c78d08463254460b324a17d078586 (diff) | |
download | rails-e4e1b62007fe40c4277ebc30067837a91bf25967.tar.gz rails-e4e1b62007fe40c4277ebc30067837a91bf25967.tar.bz2 rails-e4e1b62007fe40c4277ebc30067837a91bf25967.zip |
Use Rack to generate query information under test
`to_query` sorts parameters before encoding them. This causes a round
tripping issue as noted here:
https://github.com/rails/rails/issues/23997#issuecomment-328297933
https://github.com/rails/rails/issues/10529#issuecomment-328298109
https://github.com/rails/rails/pull/30558
Unfortunately, that method is being used to generate cache keys, so its
results need to be stable:
https://github.com/rails/rails/commit/10dec0e65e1f4d87f411b4361045eba86b121be9
However, the test harness is only using `to_query` to encode parameters
before sending them to the controller so the "cache key" usecase doesn't
apply here.
This commit adds a test that demonstrates the round trip problems and
changes the serialization strategy to use Rack for encoding the
parameters rather than `to_query`.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 5d784ceb31..33b0bcbefe 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -109,7 +109,7 @@ module ActionController when :xml data = non_path_parameters.to_xml when :url_encoded_form - data = non_path_parameters.to_query + data = Rack::Utils.build_nested_query(non_path_parameters) else @custom_param_parsers[content_mime_type.symbol] = ->(_) { non_path_parameters } data = non_path_parameters.to_query |