Class: NewRelic::Agent::HTTPClients::TyphoeusHTTPResponse

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

Instance Method Summary collapse

Methods inherited from AbstractResponse

#has_status_code?, #initialize, #status_code

Constructor Details

This class inherits a constructor from NewRelic::Agent::HTTPClients::AbstractResponse

Instance Method Details

#[](key) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/new_relic/agent/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
    # nonexistent header will return the hash itself, not what we want.
    result == headers ? nil : result
  end
end

#to_hashObject



21
22
23
24
25
26
27
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 21

def to_hash
  hash = {}
  headers.each do |(k, v)|
    hash[k] = v
  end
  hash
end