class NewRelic::Agent::HTTPClients::HTTPXHTTPResponse

Public Class Methods

new(response) click to toggle 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

[](key) click to toggle source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 32
def [](key)
  headers[format_key(key)]
end
headers() click to toggle 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
status_code() click to toggle source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 28
def status_code
  @response.status
end
to_hash()
Alias for: headers

Private Instance Methods

format_key(key) click to toggle source
# File lib/new_relic/agent/http_clients/httpx_wrappers.rb, line 45
def format_key(key)
  key.tr('-', '_').downcase
end