Class: NewRelic::Agent::HTTPClients::EthonHTTPResponse
- Inherits:
-
AbstractResponse
- Object
- AbstractResponse
- NewRelic::Agent::HTTPClients::EthonHTTPResponse
- Defined in:
- lib/new_relic/agent/http_clients/ethon_wrappers.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #headers ⇒ Object (also: #to_hash)
-
#initialize(easy) ⇒ EthonHTTPResponse
constructor
A new instance of EthonHTTPResponse.
- #status_code ⇒ Object
Methods inherited from AbstractResponse
Constructor Details
#initialize(easy) ⇒ EthonHTTPResponse
Returns a new instance of EthonHTTPResponse.
12 13 14 |
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 12 def initialize(easy) @easy = easy end |
Instance Method Details
#[](key) ⇒ Object
20 21 22 |
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 20 def [](key) headers[format_key(key)] end |
#headers ⇒ Object Also known as: to_hash
24 25 26 27 28 29 |
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 24 def headers # Ethon::Easy#response_headers will return '' if headers are unset @easy.response_headers.scan(/\n([^:]+?): ([^:\n]+?)\r/).each_with_object({}) do |pair, hash| hash[format_key(pair[0])] = pair[1] end end |
#status_code ⇒ Object
16 17 18 |
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 16 def status_code @easy.response_code end |