Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Commit

Permalink
Do not sort query params on request
Browse files Browse the repository at this point in the history
I wrongly sorted query params at 261b280 for making debug easier...
Closes nahi#65.
  • Loading branch information
Hiroshi Nakamura committed Oct 12, 2011
1 parent a126235 commit 4049bd6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/httpclient/http.rb
Expand Up @@ -787,7 +787,7 @@ def create_query_part_str(query) # :nodoc:
end

def escape_query(query) # :nodoc:
query.sort_by { |attr, value| attr.to_s }.collect { |attr, value|
query.collect { |attr, value|
if value.respond_to?(:read)
value = value.read
end
Expand Down
5 changes: 5 additions & 0 deletions test/test_httpclient.rb
Expand Up @@ -1356,6 +1356,11 @@ def test_socket_local
end
end

def test_body_param_order
ary = ('b'..'d').map { |k| ['key2', k] } << ['key1', 'a'] << ['key3', 'z']
assert_equal("key2=b&key2=c&key2=d&key1=a&key3=z", HTTP::Message.escape_query(ary))
end

private

def check_query_get(query)
Expand Down

0 comments on commit 4049bd6

Please sign in to comment.