Class: Net::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/core-ext/net/http.rb

Instance Method Summary collapse

Instance Method Details

#orig_requestObject



6
# File 'lib/core-ext/net/http.rb', line 6

alias_method :orig_request, :request

#request(req, body = nil, &block) ⇒ Object

hook into net code to get request and response for it



9
10
11
12
13
14
15
# File 'lib/core-ext/net/http.rb', line 9

def request(req, body = nil, &block)  # :yield: +response+
  return orig_request req, body, &block unless started? #if not started don't log twice
  NetObserver::Base.instance.request_data(self, req, body)
  res = orig_request req, body, &block
  NetObserver::Base.instance.response_data(self, res)
  res
end