11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/spaceborne.rb', line 11
def wrap_request(&block)
block.call
rescue Exception => e
puts "TIME: #{Time.now.strftime("%d/%m/%Y %H:%M")}"
puts "REQUEST: #{response.request.method.upcase} #{response.request.url}"
puts " HEADERS:\n#{JSON::pretty_generate(response.request.)}"
puts " PAYLOAD:\n#{@request_body}" if @request_body
puts "RESPONSE: #{response.code}"
puts " HEADERS:\n#{JSON::pretty_generate(response.)}"
if response.request.method.downcase != 'head'
if is_json?(response.)
puts " JSON_BODY\n#{JSON::pretty_generate(json_body)}"
else
puts " BODY\n#{response.body}"
end
end
raise e
end
|