Class: OneApm::Support::HTTPClients::TyphoeusHTTPResponse
- Inherits:
-
Object
- Object
- OneApm::Support::HTTPClients::TyphoeusHTTPResponse
- Defined in:
- lib/one_apm/support/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.
7 8 9 |
# File 'lib/one_apm/support/http_clients/typhoeus_wrappers.rb', line 7 def initialize(response) @response = response end |
Instance Method Details
#[](key) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/one_apm/support/http_clients/typhoeus_wrappers.rb', line 11 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
21 22 23 24 25 26 27 |
# File 'lib/one_apm/support/http_clients/typhoeus_wrappers.rb', line 21 def to_hash hash = {} headers.each do |(k,v)| hash[k] = v end hash end |