Class: NewRelic::Agent::HTTPClients::TyphoeusHTTPResponse
- Inherits:
-
Object
- Object
- NewRelic::Agent::HTTPClients::TyphoeusHTTPResponse
- Defined in:
- lib/new_relic/agent/http_clients/typhoeus_wrappers.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(response) ⇒ TyphoeusHTTPResponse
constructor
A new instance of TyphoeusHTTPResponse.
- #to_hash ⇒ Object
Constructor Details
#initialize(response) ⇒ TyphoeusHTTPResponse
Returns a new instance of TyphoeusHTTPResponse.
9 10 11 |
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 9 def initialize(response) @response = response end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 13 def [](key) unless headers.nil? result = headers[key] # Typhoeus 0.5.3 has a bug where asking the headers hash for a # non-existent header will return the hash itself, not what we want. result == headers ? nil : result end end |
#to_hash ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 23 def to_hash hash = {} headers.each do |(k,v)| hash[k] = v end hash end |