Class: NewRelic::Agent::HTTPClients::HTTPRequest
- Inherits:
-
AbstractRequest
- Object
- AbstractRequest
- NewRelic::Agent::HTTPClients::HTTPRequest
- Defined in:
- lib/new_relic/agent/http_clients/http_rb_wrappers.rb
Constant Summary collapse
- HTTP_RB =
'http.rb'
- HOST =
'host'
- COLON =
':'
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #headers ⇒ Object
- #host ⇒ Object
- #host_from_header ⇒ Object
-
#initialize(wrapped_request) ⇒ HTTPRequest
constructor
A new instance of HTTPRequest.
- #method ⇒ Object
- #type ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(wrapped_request) ⇒ HTTPRequest
Returns a new instance of HTTPRequest.
26 27 28 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 26 def initialize(wrapped_request) @wrapped_request = wrapped_request end |
Instance Method Details
#[](key) ⇒ Object
52 53 54 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 52 def [](key) @wrapped_request.headers[key] end |
#[]=(key, value) ⇒ Object
56 57 58 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 56 def []=(key, value) @wrapped_request.headers[key] = value end |
#headers ⇒ Object
60 61 62 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 60 def headers @wrapped_request.headers.to_hash end |
#host ⇒ Object
44 45 46 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 44 def host host_from_header || @wrapped_request.host end |
#host_from_header ⇒ Object
38 39 40 41 42 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 38 def host_from_header if hostname = self[HOST] hostname.split(COLON).first end end |
#method ⇒ Object
48 49 50 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 48 def method @wrapped_request.verb.upcase end |
#type ⇒ Object
34 35 36 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 34 def type HTTP_RB end |
#uri ⇒ Object
30 31 32 |
# File 'lib/new_relic/agent/http_clients/http_rb_wrappers.rb', line 30 def uri @uri ||= URIUtil.parse_and_normalize_url(@wrapped_request.uri) end |