Sha256: 77033cb3bbe63758a0db914191238bff55ee39621d688653ea7ebcbb61112907

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

require_relative '../response'

module Datadog
  module Transport
    module HTTP
      # Wraps an HTTP response from an adapter.
      #
      # Used by endpoints to wrap responses from adapters with
      # fields or behavior that's specific to that endpoint.
      module Response
        def initialize(http_response)
          @http_response = http_response
        end

        # (see Datadog::Transport::Response#payload)
        def payload
          @http_response.payload
        end

        # (see Datadog::Transport::Response#internal_error?)
        def internal_error?
          @http_response.internal_error?
        end

        # (see Datadog::Transport::Response#unsupported?)
        def unsupported?
          @http_response.unsupported?
        end

        # (see Datadog::Transport::Response#ok?)
        def ok?
          @http_response.ok?
        end

        # (see Datadog::Transport::Response#not_found?)
        def not_found?
          @http_response.not_found?
        end

        # (see Datadog::Transport::Response#client_error?)
        def client_error?
          @http_response.client_error?
        end

        # (see Datadog::Transport::Response#server_error?)
        def server_error?
          @http_response.server_error?
        end

        def code
          @http_response.respond_to?(:code) ? @http_response.code : nil
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ddtrace-1.14.0 lib/ddtrace/transport/http/response.rb
ddtrace-1.13.1 lib/ddtrace/transport/http/response.rb
ddtrace-1.13.0 lib/ddtrace/transport/http/response.rb
ddtrace-1.12.1 lib/ddtrace/transport/http/response.rb
ddtrace-1.12.0 lib/ddtrace/transport/http/response.rb
ddtrace-1.11.1 lib/ddtrace/transport/http/response.rb
ddtrace-1.11.0 lib/ddtrace/transport/http/response.rb
ddtrace-1.11.0.beta1 lib/ddtrace/transport/http/response.rb