Class: NewRelic::Agent::HTTPClients::CurbResponse

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

Instance Method Summary collapse

Methods inherited from AbstractResponse

#has_status_code?, #status_code

Constructor Details

#initialize(wrapped_response) ⇒ CurbResponse

Returns a new instance of CurbResponse.



51
52
53
54
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 51

def initialize(wrapped_response)
  super(wrapped_response)
  @headers = {}
end

Instance Method Details

#[](key) ⇒ Object



56
57
58
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 56

def [](key)
  @headers[key.downcase]
end

#append_header_data(data) ⇒ Object



64
65
66
67
68
69
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 64

def append_header_data(data)
  key, value = data.split(/:\s*/, 2)
  @headers[key.downcase] = value
  @wrapped_response._nr_header_str ||= +''
  @wrapped_response._nr_header_str << data
end

#to_hashObject



60
61
62
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 60

def to_hash
  @headers.dup
end