Class: Datadog::Core::Remote::Transport::HTTP::Config::API::Endpoint

Inherits:
Transport::HTTP::API::Endpoint show all
Defined in:
lib/datadog/core/remote/transport/http/config.rb

Overview

Endpoint for remote configuration

Constant Summary collapse

HEADER_CONTENT_TYPE =
'Content-Type'

Instance Attribute Summary collapse

Attributes inherited from Transport::HTTP::API::Endpoint

#path, #verb

Instance Method Summary collapse

Constructor Details

#initialize(path, encoder) ⇒ Endpoint



187
188
189
190
# File 'lib/datadog/core/remote/transport/http/config.rb', line 187

def initialize(path, encoder)
  super(:post, path)
  @encoder = encoder
end

Instance Attribute Details

#encoderObject (readonly)

Returns the value of attribute encoder.



185
186
187
# File 'lib/datadog/core/remote/transport/http/config.rb', line 185

def encoder
  @encoder
end

Instance Method Details

#call(env, &block) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/datadog/core/remote/transport/http/config.rb', line 192

def call(env, &block)
  # Encode body & type
  env.headers[HEADER_CONTENT_TYPE] = encoder.content_type
  env.body = env.request.parcel.data

  # Query for response
  http_response = super

  response_options = {}

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