1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[AWS] print out raw response string when DEBUG_RESPONSE env var is set

This commit is contained in:
Michael Hale 2013-08-01 12:20:37 -04:00
parent 3be707e235
commit 12451fe06e

View file

@ -26,12 +26,15 @@ module Fog
# Prepare the SAX parser # Prepare the SAX parser
data_stream = Nokogiri::XML::SAX::PushParser.new(parser) data_stream = Nokogiri::XML::SAX::PushParser.new(parser)
response_string = ""
params[:response_block] = lambda do |chunk, remaining, total| params[:response_block] = lambda do |chunk, remaining, total|
response_string << chunk if ENV['DEBUG_RESPONSE']
data_stream << chunk data_stream << chunk
end end
# Make request which read chunks into parser # Make request which read chunks into parser
response = @excon.request(params) response = @excon.request(params)
Fog::Logger.debug "\n#{response_string}" if ENV['DEBUG_RESPONSE']
# Cease parsing and override response.body with parsed data # Cease parsing and override response.body with parsed data
data_stream.finish data_stream.finish