Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHEF-2682] Redirected API requests can result in confusing error messages #534

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/chef/rest.rb
Expand Up @@ -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.
Expand Down