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:
parent
3be707e235
commit
12451fe06e
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue