class NewRelic::Agent::HTTPClients::HTTPXHTTPResponse
Public Class Methods
Source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 20 def initialize(response) if response.is_a?(::HTTPX::ErrorResponse) @response = response.response || HTTPXErrorResponse.new else @response = response end end
Public Instance Methods
Source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 32 def [](key) headers[format_key(key)] end
Source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 36 def headers headers ||= @response.headers.to_hash.each_with_object({}) do |(k, v), h| h[format_key(k)] = v end end
Also aliased as: to_hash
Source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 28 def status_code @response.status end
Private Instance Methods
Source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 45 def format_key(key) key.tr('-', '_').downcase end