Closed dredozubov closed 11 years ago
I overlooked a whole query params issue, but url.request_uri
should address both our concerns.
General case
URI.parse('http://example.com/').request_uri
=> "/"
Root-level uri. It's the main point i was making after all. It's critical in production after the forced move to the net-http driver. Old code returns ""
at this point and it will break any Net::HTTP call.
URI.parse('http://example.com').request_uri
=> "/"
Case with request parameters.
URI.parse('http://example.com/?param1=foo¶m2=bar').request_uri
=> "/?param1=foo¶m2=bar"
Yes, much simpler code too. I'm not sure why this wasn't just used originally - I'm wondering if there was a reason, but I can't really come to think of anything. I'll merge the change.
Basically this fixes the problem with net-http driver and root-level uris like https://example.com. Otherwise it raises error. Also got rid of useless call to private method.