Class: NewRelic::Agent::HTTPClients::ExconHTTPResponse

Inherits:
AbstractResponse show all
Defined in:
lib/new_relic/agent/http_clients/excon_wrappers.rb

Instance Method Summary collapse

Methods inherited from AbstractResponse

#has_status_code?, #status_code

Constructor Details

#initialize(wrapped_response) ⇒ ExconHTTPResponse

Returns a new instance of ExconHTTPResponse.



11
12
13
14
15
16
17
18
19
20
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 11

def initialize(wrapped_response)
  super(wrapped_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 = {}
  (get_attribute(:headers) || {}).each do |key, val|
    @normalized_headers[key.upcase] = val
  end
end

Instance Method Details

#[](key) ⇒ Object



22
23
24
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 22

def [](key)
  @normalized_headers[key.upcase]
end

#to_hashObject



26
27
28
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 26

def to_hash
  @normalized_headers.dup
end