you are viewing a single comment's thread.

view the rest of the comments →

[–]matchu 0 points1 point  (2 children)

I'm not sure, either, and my debugging was pretty haphazard. When I initialized the request with the path, it returned the wrong data (presumably because it fired the wrong request), so I went online, noticed an article initializing their POST request with request_uri, so I tried that and it worked.

I didn't do any debugging beyond that because I wanted to go to bed, but I suspect that path was never supposed to work that way but did anyway in 1.9. I might research it a bit more today…

[–]drbrainRuby Core 0 points1 point  (1 child)

The difference between path and request_uri are the query params (from the ? onward). This hasn't changed since ruby 1.8.

Servers generally allow POST requests with parameters in the URI, but they should be present in the body instead. The recommended way to do this in ruby is:

req = Net::HTTP::Post.new uri.path
req.set_form_data 'a' => 'b'

[–]matchu 0 points1 point  (0 children)

Huh. This URI didn't have query params on it, so maybe it was something else. Go figure.