summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-03-03 09:47:33 -0800
committerGitHub <noreply@github.com>2017-03-03 09:47:33 -0800
commitbd450bb915a99d061f7ba81d156cf0f87e062906 (patch)
tree619dc966659b7b208e30c84b5720e7c9f9226866
parent46d19a502fb8824fa3fccf4535fcfa226c4e9473 (diff)
parente6484445fb873b2ccc5448cd4e6fc2b00ecbaf5b (diff)
downloadchef-bd450bb915a99d061f7ba81d156cf0f87e062906.tar.gz
Merge pull request #5858 from chef/lcg/debug-log-bad-json-payload
HTTP: add debug long for non-JSON response
-rw-r--r--lib/chef/http/json_output.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/chef/http/json_output.rb b/lib/chef/http/json_output.rb
index 6053c38a56..dc363cdc54 100644
--- a/lib/chef/http/json_output.rb
+++ b/lib/chef/http/json_output.rb
@@ -1,7 +1,7 @@
#--
# Author:: Daniel DeLeo (<dan@chef.io>)
# Author:: John Keiser (<jkeiser@chef.io>)
-# Copyright:: Copyright 2013-2016, Chef Software Inc.
+# Copyright:: Copyright 2013-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -61,6 +61,9 @@ class Chef
[http_response, rest_request, return_value]
else
Chef::Log.debug("Expected JSON response, but got content-type '#{http_response['content-type']}'")
+ if http_response.body
+ Chef::Log.debug("Response body contains:\n#{http_response.body.length < 256 ? http_response.body : http_response.body[0..256] + " [...truncated...]"}")
+ end
return [http_response, rest_request, http_response.body.to_s]
end
end