module Ethon::Easy::Operations

Public Instance Methods

orig_perform()
Alias for: perform
perform() click to toggle source
# File lib/binnacle/http_logging/adapters/ethon.rb, line 22
def perform
  _url = _url || @url || @binnacle_backup_url
  return orig_perform unless Binnacle::HttpLogger.allow?(_url)

  _response_code = nil
  bm = Benchmark.realtime do
    _response_code = orig_perform
  end

  uri = URI(_url)
  status   = response_headers.scan(/HTTP\/... (\d{3})/).flatten.first
  encoding = response_headers.scan(/Content-Encoding: (\S+)/).flatten.first
  content_type = response_headers.scan(/Content-Type: (\S+(; charset=\S+)?)/).flatten.first
  url_without_query = "#{uri.scheme}://#{uri.host}:#{uri.port}#{uri.path}"

  Binnacle::HttpLogger.signal(url_without_query, @binnacle_action_name, uri.host, uri.port, uri.path, uri.query, response_code, bm, @binnacle_request_headers, response_body, encoding, content_type, @binnacle_request_data)

  return_code
end
Also aliased as: orig_perform