Class: NewRelic::Agent::HTTPClients::ExconHTTPResponse
- Inherits:
-
Object
- Object
- NewRelic::Agent::HTTPClients::ExconHTTPResponse
- Defined in:
- lib/new_relic/agent/http_clients/excon_wrappers.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(response) ⇒ ExconHTTPResponse
constructor
A new instance of ExconHTTPResponse.
- #to_hash ⇒ Object
Constructor Details
#initialize(response) ⇒ ExconHTTPResponse
Returns a new instance of ExconHTTPResponse.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 9 def initialize(response) @response = response # Since HTTP headers are case-insensitive, we normalize all of them to # upper case here, and then also in our [](key) implementation. @normalized_headers = {} headers = response.respond_to?(:headers) ? response.headers : response[:headers] (headers || {}).each do |key, val| @normalized_headers[key.upcase] = val end end |
Instance Method Details
#[](key) ⇒ Object
20 21 22 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 20 def [](key) @normalized_headers[key.upcase] end |
#to_hash ⇒ Object
24 25 26 |
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 24 def to_hash @normalized_headers.dup end |