From a37c1b44aae2988549f61626156778432c909445 Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Thu, 1 Jun 2023 12:52:05 +0300 Subject: [PATCH] fix: don't send all files in header (#81) --- spec/coverage_reporter/api/jobs_spec.cr | 1 - src/coverage_reporter/api/jobs.cr | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/spec/coverage_reporter/api/jobs_spec.cr b/spec/coverage_reporter/api/jobs_spec.cr index 3a6d0bc4..dc5caea6 100644 --- a/spec/coverage_reporter/api/jobs_spec.cr +++ b/spec/coverage_reporter/api/jobs_spec.cr @@ -42,7 +42,6 @@ Spectator.describe CoverageReporter::Api::Jobs do "X-Coveralls-Reporter" => "coverage-reporter", "X-Coveralls-Reporter-Version" => CoverageReporter::VERSION, "X-Coveralls-Coverage-Formats" => "cobertura", - "X-Coveralls-Files" => "cobertura.xml", "X-Coveralls-Source" => "cli", }, body: { diff --git a/src/coverage_reporter/api/jobs.cr b/src/coverage_reporter/api/jobs.cr index fc9bb711..0b863176 100644 --- a/src/coverage_reporter/api/jobs.cr +++ b/src/coverage_reporter/api/jobs.cr @@ -24,21 +24,23 @@ module CoverageReporter data = build_request api_url = "#{@config.endpoint}/api/#{API_VERSION}/jobs" + headers = DEFAULT_HEADERS.merge({ + "Content-Type" => "application/json", + "X-Coveralls-Coverage-Formats" => @source_files.map(&.format.to_s).sort!.uniq!.join(","), + "X-Coveralls-CI" => @config[:service_name]?, + }.compact) + Log.info " ·job_flag: #{@config.flag_name}" if @config.flag_name Log.info "🚀 Posting coverage data to #{api_url}" + Log.debug "---\n⛑ Debug Headers:\n#{headers.to_pretty_json}" Log.debug "---\n⛑ Debug Output:\n#{data.to_pretty_json}" return if dry_run res = Crest.post( api_url, - headers: DEFAULT_HEADERS.merge({ - "Content-Type" => "application/json", - "X-Coveralls-Coverage-Formats" => @source_files.map(&.format.to_s).sort!.uniq!.join(","), - "X-Coveralls-Files" => @source_files.filenames.join(","), - "X-Coveralls-CI" => @config[:service_name]?, - }.compact), + headers: headers, form: {:json => data.to_json.to_s}.to_json, tls: ENV["COVERALLS_ENDPOINT"]? ? OpenSSL::SSL::Context::Client.insecure : nil )