adamwiggins / rest-client

Simple REST client for Ruby, inspired by microframework syntax for specifying actions. Official fork is now at:
http://github.com/archiloque/rest-client
480 stars 7 forks source link

redirects should be :get's and should get rid of params #1

Closed stellsmi closed 14 years ago

stellsmi commented 15 years ago

like so :

module RestClient class Request def execute execute_inner rescue Redirect => e @method = :get @payload = nil @url = e.url execute end end end

kgilpin commented 15 years ago

According to spec

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

this is only required for 303 redirection, but most server side libraries are going to keep using 302s. So switching to GET should definitely be the behavior for 303 redirection, and maybe should be a configurable option for 302.

bradediger commented 15 years ago

Not only is this required for 303 redirection, per kgilpin's link, RFC2616 prohibits the current behavior. The most common behavior of user agents is that provided above -- the redirect is followed with GET and no payload. Above patch, with tests, at bradediger/rest-client@cdad894.

bradediger commented 15 years ago

github didn't like my link. here it is: http://bit.ly/ePiI8

archiloque commented 14 years ago

Fixed with http://github.com/adamwiggins/rest-client/commit/2db1f0bc3338e28146b86c605664956e1e3534fe