class NewRelic::Agent::HTTPClients::EthonHTTPResponse
Public Class Methods
Source
# File lib/new_relic/agent/http_clients/ethon_wrappers.rb, line 12 def initialize(easy) @easy = easy end
Public Instance Methods
Source
# File lib/new_relic/agent/http_clients/ethon_wrappers.rb, line 20 def [](key) headers[format_key(key)] end
Source
# File lib/new_relic/agent/http_clients/ethon_wrappers.rb, line 24 def headers # Ethon::Easy#response_headers will return '' if headers are unset @easy.response_headers.scan(/\n([^:]+?): ([^:\n]+?)\r/).each_with_object({}) do |pair, hash| hash[format_key(pair[0])] = pair[1] end end
Also aliased as: to_hash
Source
# File lib/new_relic/agent/http_clients/ethon_wrappers.rb, line 16 def status_code @easy.response_code end
Private Instance Methods
Source
# File lib/new_relic/agent/http_clients/ethon_wrappers.rb, line 34 def format_key(key) key.tr('-', '_').downcase end