class Net::HTTP
Public Instance Methods
request(req, body = nil, &block)
click to toggle source
# File lib/binnacle/http_logging/adapters/net_http.rb, line 6 def request(req, body = nil, &block) url = "http://#{@address}:#{@port}#{req.path}" uri = URI(url) url_without_query = "#{uri.scheme}://#{uri.host}:#{uri.port}#{uri.path}" bm = Benchmark.realtime do @response = orig_request(req, body, &block) end if Binnacle::HttpLogger.allow?(url) && started? data = req.body.nil? || req.body.size == 0 ? body : req.body Binnacle::HttpLogger.signal(url_without_query, req.method, @address, @port, uri.path, uri.query, @response.code, bm, @response.each_header.collect.to_h, @response.body, @response['Content-Encoding'], @response['Content-Type'], data) end @response end
Also aliased as: orig_request