Class: NewRelic::Agent::HTTPClients::HTTPClientRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/http_clients/httpclient_wrappers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ HTTPClientRequest

Returns a new instance of HTTPClientRequest.



32
33
34
35
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 32

def initialize(request)
  @request = request
  @uri = request.header.request_uri
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



30
31
32
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 30

def request
  @request
end

#uriObject (readonly)

Returns the value of attribute uri.



30
31
32
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 30

def uri
  @uri
end

Instance Method Details

#[](key) ⇒ Object



53
54
55
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 53

def [](key)
  request.headers[key]
end

#[]=(key, value) ⇒ Object



57
58
59
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 57

def []=(key, value)
  request.http_header[key] = value
end

#hostObject



45
46
47
48
49
50
51
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 45

def host
  if hostname = (self['host'] || self['Host'])
    hostname.split(':').first
  else
    uri.host.to_s
  end
end

#methodObject



41
42
43
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 41

def method
  request.header.request_method
end

#typeObject



37
38
39
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 37

def type
  "HTTPClient"
end