1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Fix handling of 304 No Content responses

This patch retains the previous behavior of treating all 3xx responses
as redirected _except_ 304.  It may be sensible to review and remove
some status codes from auto-redirect handling such as 300 Multiple
Choice.
This commit is contained in:
Seth Falcon 2010-01-13 16:26:08 -08:00 committed by Sandro Turriate
parent dc14b30c78
commit 0f606b2402

View file

@ -135,7 +135,12 @@ module HTTParty
# Raises exception Net::XXX (http error code) if an http error occured
def handle_response(response)
case response
when Net::HTTPRedirection
when Net::HTTPMultipleChoice, # 300
Net::HTTPMovedPermanently, # 301
Net::HTTPFound, # 302
Net::HTTPSeeOther, # 303
Net::HTTPUseProxy, # 305
Net::HTTPTemporaryRedirect
options[:limit] -= 1
self.path = response['location']
@redirect = true