Class: URI::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_web_matcher/request_matcher.rb

Overview

Monkey patch to add a normalize! method to the URI::HTTP class. It doesn't currently sort the query params which means two URLs that are equivalent except for a different order of query params will be !=. This isn't how FakeWeb works, so we patch it here.

Instance Method Summary collapse

Instance Method Details

#normalize!Object

Normalize an HTTP URI so that query param order differences don't affect equality.



14
15
16
17
18
19
20
# File 'lib/fake_web_matcher/request_matcher.rb', line 14

def normalize!
  if query
    query_array = self.query.split('&')
    set_query(query_array.sort.join('&'))
  end
  super
end