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

Always maintain method for 307 & 308 responses

Resolves #418
This commit is contained in:
James Billingham 2015-07-08 14:33:06 +01:00
parent f8fa623578
commit dd6ecfb821

View file

@ -276,7 +276,7 @@ module HTTParty
unless options[:maintain_method_across_redirects] && options[:resend_on_redirect]
self.http_method = Net::HTTP::Get
end
else
elsif last_response.code != 307 && last_response.code != 308
unless options[:maintain_method_across_redirects]
self.http_method = Net::HTTP::Get
end
@ -305,12 +305,9 @@ module HTTParty
def response_redirects?
case last_response
when Net::HTTPMultipleChoice, # 300
Net::HTTPMovedPermanently, # 301
Net::HTTPFound, # 302
Net::HTTPSeeOther, # 303
Net::HTTPUseProxy, # 305
Net::HTTPTemporaryRedirect
when Net::HTTPNotModified # 304
false
when Net::HTTPRedirection
options[:follow_redirects] && last_response.key?('location')
end
end