adamwiggins/rest-client

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

stellsmi opened this issue · 4 comments

like so :

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

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.

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.

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