6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/http/ext/net_http.rb', line 6
def request_with_wiretap(request, body = nil, &block)
request_id = nil
if ::HTTP::Wiretap.enabled
request_id = ::HTTP::Wiretap.log_request(self, request)
end
block_response = nil
block_wrapper = lambda do |res|
puts "inside: #{res}"
block_response = res
block.call(res) unless block.nil?
res
end
return_response = request_without_wiretap(request, body, &block_wrapper)
response = nil
response = return_response if return_response.is_a?(Net::HTTPResponse)
response = block_response if response.nil?
if ::HTTP::Wiretap.enabled
::HTTP::Wiretap.log_response(self, response, request_id)
end
end
|