class NewRelic::Agent::HTTPClients::AsyncHTTPRequest

Constants

ASYNC_HTTP

Public Class Methods

new(connection, method, url, headers) click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 26
def initialize(connection, method, url, headers)
  @connection = connection
  @method = method
  @url = ::NewRelic::Agent::HTTPClients::URIUtil.parse_and_normalize_url(url)
  @headers = headers
end

Public Instance Methods

[](key) click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 49
def [](key)
  return headers[key] unless headers.is_a?(Array)

  headers.each do |header|
    return header[1] if header[0].casecmp?(key)
  end
  nil
end
[]=(key, value) click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 58
def []=(key, value)
  if headers.is_a?(Array)
    headers << [key, value]
  else
    headers[key] = value
  end
end
headers() click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 70
def headers
  @headers
end
host() click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 45
def host
  host_from_header || uri.host.to_s
end
host_from_header() click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 39
def host_from_header
  if hostname = (self[LHOST] || self[UHOST])
    hostname.split(COLON).first
  end
end
method() click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 74
def method
  @method
end
type() click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 35
def type
  ASYNC_HTTP
end
uri() click to toggle source
# File lib/new_relic/agent/http_clients/async_http_wrappers.rb, line 66
def uri
  @url
end