Class: NewRelic::Agent::HTTPClients::ExconHTTPRequest
- Inherits:
-
AbstractRequest
- Object
- AbstractRequest
- NewRelic::Agent::HTTPClients::ExconHTTPRequest
- Defined in:
- lib/new_relic/agent/http_clients/excon_wrappers.rb
Constant Summary collapse
- EXCON =
'Excon'
- LHOST =
'host'
- UHOST =
'Host'
- COLON =
':'
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #headers ⇒ Object
- #host ⇒ Object
- #host_from_header ⇒ Object
-
#initialize(datum) ⇒ ExconHTTPRequest
constructor
A new instance of ExconHTTPRequest.
- #type ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(datum) ⇒ ExconHTTPRequest
Returns a new instance of ExconHTTPRequest.
54 55 56 57 58 59 60 61 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 54 def initialize(datum) @datum = datum @method = @datum[:method].to_s.upcase @scheme = @datum[:scheme] @port = @datum[:port] @path = @datum[:path] end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
47 48 49 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 47 def method @method end |
Instance Method Details
#[](key) ⇒ Object
77 78 79 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 77 def [](key) headers[key] end |
#[]=(key, value) ⇒ Object
81 82 83 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 81 def []=(key, value) headers[key] = value end |
#headers ⇒ Object
90 91 92 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 90 def headers @datum[:headers] end |
#host ⇒ Object
73 74 75 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 73 def host host_from_header || @datum[:host] end |
#host_from_header ⇒ Object
67 68 69 70 71 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 67 def host_from_header if hostname = (headers[LHOST] || headers[UHOST]) hostname.split(COLON).first end end |
#type ⇒ Object
63 64 65 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 63 def type EXCON end |
#uri ⇒ Object
85 86 87 88 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 85 def uri url = "#{@scheme}://#{host}:#{@port}#{@path}" URIUtil.parse_and_normalize_url(url) end |