diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ab11ced..d66861a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# Addressable 3.0 +- removed default query param sorting + # Addressable 2.3.2 - added Addressable::URI#default_port method - fixed issue with Marshalling Unicode data on Windows diff --git a/lib/addressable/uri.rb b/lib/addressable/uri.rb index a75bf4b3..660827b1 100644 --- a/lib/addressable/uri.rb +++ b/lib/addressable/uri.rb @@ -1607,9 +1607,6 @@ def query_values=(new_query_values) key = key.to_s if key.kind_of?(Symbol) [key, value] end - # Useful default for OAuth and caching. - # Only to be used for non-Array inputs. Arrays should preserve order. - new_query_values.sort! end # new_query_values have form [['key1', 'value1'], ['key2', 'value2']] diff --git a/spec/addressable/uri_spec.rb b/spec/addressable/uri_spec.rb index 056b3336..97c7038b 100644 --- a/spec/addressable/uri_spec.rb +++ b/spec/addressable/uri_spec.rb @@ -5696,9 +5696,10 @@ def to_str @uri.query.should == nil end - it "should correctly sort {'ab' => 'c', :ab => 'a', :a => 'x'}" do + it "maintains original ordering: {'ab' => 'c', :ab => 'a', :a => 'x'}" do @uri.query_values = {'ab' => 'c', :ab => 'a', :a => 'x'} - @uri.query.should == "a=x&ab=a&ab=c" + + @uri.query.should == "ab=c&ab=a&a=x" end it "should correctly assign " +