Sha256: 9821d9b4e453af64e6f1536fc73aee57ad6727017f81a1031e9fa5939e7dce0e

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require "datadog/core/environment/container"

require_relative "base"
require_relative "../../ext/transport"

module Datadog
  module CI
    module Transport
      module Api
        class EvpProxy < Base
          def request(path:, payload:, verb: "post")
            path = "#{Ext::Transport::EVP_PROXY_PATH_PREFIX}#{path.sub(/^\//, "")}"

            super(
              path: path,
              payload: payload,
              verb: verb
            )
          end

          private

          def container_id
            return @container_id if defined?(@container_id)

            @container_id = Datadog::Core::Environment::Container.container_id
          end

          def headers
            headers = super
            headers[Ext::Transport::HEADER_EVP_SUBDOMAIN] = Ext::Transport::TEST_VISIBILITY_INTAKE_HOST_PREFIX

            c_id = container_id
            headers[Ext::Transport::HEADER_CONTAINER_ID] = c_id unless c_id.nil?

            headers
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
datadog-ci-0.7.0 lib/datadog/ci/transport/api/evp_proxy.rb
datadog-ci-0.6.0 lib/datadog/ci/transport/api/evp_proxy.rb
datadog-ci-0.5.1 lib/datadog/ci/transport/api/evp_proxy.rb
datadog-ci-0.5.0 lib/datadog/ci/transport/api/evp_proxy.rb
datadog-ci-0.4.1 lib/datadog/ci/transport/api/evp_proxy.rb
datadog-ci-0.4.0 lib/datadog/ci/transport/api/evp_proxy.rb
datadog-ci-0.3.0 lib/datadog/ci/transport/api/evp_proxy.rb