Skip to content

Commit

Permalink
fix: don't send all files in header (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Jun 1, 2023
1 parent 6e7d716 commit a37c1b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion spec/coverage_reporter/api/jobs_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
14 changes: 8 additions & 6 deletions src/coverage_reporter/api/jobs.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit a37c1b4

Please sign in to comment.