Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug fixed: sorting query parameters from URI objects at register uri …

…time.
  • Loading branch information...
commit 95428ddd6405d53f27867c3d1057e43cbbd2816e 1 parent f62cf41
@anselmoalves anselmoalves authored
Showing with 9 additions and 2 deletions.
  1. +4 −2 lib/fake_web/registry.rb
  2. +5 −0 test/test_query_string.rb
View
6 lib/fake_web/registry.rb
@@ -58,8 +58,10 @@ def response_for(method, uri, &block)
def normalize_uri(uri)
normalized_uri =
case uri
- when URI then uri
- else
+ when URI then
+ uri.query = sort_query_params(uri.query)
+ uri
+ else
uri = 'http://' + uri unless uri.match('^https?://')
parsed_uri = URI.parse(uri)
parsed_uri.query = sort_query_params(parsed_uri.query)
View
5 test/test_query_string.rb
@@ -16,6 +16,11 @@ def test_register_uri_with_query_params_and_check_in_different_order
assert FakeWeb.registered_uri?('http://example.com/?b=1&a=1')
end
+ def test_register_uri_with_query_params_unsorted_from_uri_object
+ FakeWeb.register_uri(URI.join('http://example.com/?b=1&a=1'), :string => 'foo')
+ assert FakeWeb.registered_uri?('http://example.com/?b=1&a=1')
+ end
+
def test_registered_uri_gets_recognized_with_empty_query_params
FakeWeb.register_uri('http://example.com/', :string => 'foo')
assert FakeWeb.registered_uri?('http://example.com/?')
Please sign in to comment.
Something went wrong with that request. Please try again.