Sha256: 048d10530a5296bae43c1ba5ac9b858a47c033ce04c0b2956262154516a1cc21
Contents?: true
Size: 1.68 KB
Versions: 22
Compression:
Stored size: 1.68 KB
Contents
# frozen_string_literal: true require "securerandom" require_relative "../../ext/transport" module Datadog module CI module Transport module Api class Base def api_request(path:, payload:, headers: {}, verb: "post") headers[Ext::Transport::HEADER_CONTENT_TYPE] ||= Ext::Transport::CONTENT_TYPE_JSON end def citestcycle_request(path:, payload:, headers: {}, verb: "post") headers[Ext::Transport::HEADER_CONTENT_TYPE] ||= Ext::Transport::CONTENT_TYPE_MESSAGEPACK end def citestcov_request(path:, payload:, headers: {}, verb: "post") citestcov_request_boundary = ::SecureRandom.uuid headers[Ext::Transport::HEADER_CONTENT_TYPE] ||= "#{Ext::Transport::CONTENT_TYPE_MULTIPART_FORM_DATA}; boundary=#{citestcov_request_boundary}" @citestcov_payload = [ "--#{citestcov_request_boundary}", 'Content-Disposition: form-data; name="event"; filename="event.json"', "Content-Type: application/json", "", '{"dummy":true}', "--#{citestcov_request_boundary}", 'Content-Disposition: form-data; name="coverage1"; filename="coverage1.msgpack"', "Content-Type: application/msgpack", "", payload, "--#{citestcov_request_boundary}--" ].join("\r\n") end def headers_with_default(headers) request_headers = default_headers request_headers.merge!(headers) end private def default_headers {} end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems