Class: NewRelic::Agent::HTTPClients::HTTPXHTTPRequest
- Inherits:
-
AbstractRequest
- Object
- AbstractRequest
- NewRelic::Agent::HTTPClients::HTTPXHTTPRequest
- Defined in:
- lib/new_relic/agent/http_clients/httpx_wrappers.rb
Constant Summary collapse
- DEFAULT_HOST =
'UNKNOWN_HOST'- TYPE =
'HTTPX'- LHOST =
'host'.freeze
- UHOST =
'Host'.freeze
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #headers ⇒ Object
- #host ⇒ Object
- #host_from_header ⇒ Object
-
#initialize(request) ⇒ HTTPXHTTPRequest
constructor
A new instance of HTTPXHTTPRequest.
- #method ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(request) ⇒ HTTPXHTTPRequest
Returns a new instance of HTTPXHTTPRequest.
58 59 60 61 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 58 def initialize(request) @request = request @uri = request.uri end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
51 52 53 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 51 def uri @uri end |
Instance Method Details
#[](key) ⇒ Object
87 88 89 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 87 def [](key) @request.headers[key] end |
#[]=(key, value) ⇒ Object
79 80 81 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 79 def []=(key, value) @request.headers[key] = value end |
#headers ⇒ Object
83 84 85 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 83 def headers @request.headers end |
#host ⇒ Object
71 72 73 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 71 def host host_from_header || uri.host&.downcase || DEFAULT_HOST end |
#host_from_header ⇒ Object
67 68 69 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 67 def host_from_header self[LHOST] || self[UHOST] end |
#method ⇒ Object
75 76 77 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 75 def method @request.verb end |
#type ⇒ Object
63 64 65 |
# File 'lib/new_relic/agent/http_clients/httpx_wrappers.rb', line 63 def type TYPE end |