From a48968c1ce2fbe320c67623ba3f16e8ccbcb1944 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 13 Aug 2021 10:37:30 -0700 Subject: [PATCH] build: do not pass undefined to Auth header in CI scripts --- script/release/ci-release-build.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/script/release/ci-release-build.js b/script/release/ci-release-build.js index 8b3802fba153..2452149b778b 100644 --- a/script/release/ci-release-build.js +++ b/script/release/ci-release-build.js @@ -36,11 +36,14 @@ const vstsArmJobs = [ let jobRequestedCount = 0; async function makeRequest ({ auth, url, headers, body, method }) { + const clonedHeaders = { + ...(headers || {}) + }; + if (auth && auth.bearer) { + clonedHeaders.Authorization = `Bearer ${auth.bearer}`; + } const response = await got(url, { - headers: { - Authorization: auth && auth.bearer ? `Bearer ${auth.bearer}` : undefined, - ...(headers || {}) - }, + headers: clonedHeaders, body, method, auth: auth && auth.password ? `${auth.username}:${auth.password}` : undefined