module NetHttpWrapper

Allows registering callbacks on `Net::HTTP#request` method.

Constants

VERSION

Public Instance Methods

request(req, body = nil, &block) click to toggle source
Calls superclass method
# File lib/net_http_wrapper.rb, line 55
def request(req, body = nil, &block)
  start_time = Time.now
  super.tap do |resp|
    next unless NetHttpWrapper.enabled?

    NetHttpWrapper.after_request_callbacks.each do |callback|
      callback.call(http: self,
                    request: req,
                    response: resp,
                    start_time: start_time)
    end
  end
end