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