Class: URI::HTTP
- Inherits:
-
Object
- Object
- URI::HTTP
- 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
-
#normalize! ⇒ Object
Normalize an HTTP URI so that query param order differences don't affect equality.
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 21 22 23 24 25 |
# File 'lib/fake_web_matcher/request_matcher.rb', line 14 def normalize! if query normalised_query = self.query.split('&').sort.join('&') if respond_to? :set_query set_query normalised_query else self.query = normalised_query end end super end |