Method: Datadog::Core::Remote::Transport::HTTP::Negotiation::API::Endpoint#call

Defined in:
lib/datadog/core/remote/transport/http/negotiation.rb

#call(env, &block) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/datadog/core/remote/transport/http/negotiation.rb', line 80

def call(env, &block)
  # Query for response
  http_response = super

  # Process the response
  body = JSON.parse(http_response.payload, symbolize_names: true) if http_response.ok?

  # TODO: there should be more processing here to ensure a proper response_options
  response_options = body.is_a?(Hash) ? body : {}

  # Build and return a trace response
  Negotiation::Response.new(http_response, response_options)
end