From 36d98da309da9c4b39982a7cc4eae79679bd6c12 Mon Sep 17 00:00:00 2001 From: Loic ANTOINE-GOMBEAUD Date: Wed, 12 Dec 2012 16:13:39 +0000 Subject: [PATCH] added warning when following a redirect with a different method than that of the original request --- lib/chef/rest.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb index 23835773691..7a6339818ce 100644 --- a/lib/chef/rest.rb +++ b/lib/chef/rest.rb @@ -222,6 +222,9 @@ def raw_http_request(method, url, headers, body) elsif response.kind_of?(Net::HTTPNotModified) # Must be tested before Net::HTTPRedirection because it's subclass. false elsif redirect_location = redirected_to(response) + if method != :GET + Chef::Log.warn("Following a redirect with GET, original request's method was #{method.to_s}") + end follow_redirect {api_request(:GET, create_url(redirect_location))} else # have to decompress the body before making an exception for it. But the body could be nil.