build: do not pass undefined to Auth header in CI scripts

This commit is contained in:
Samuel Attard 2021-08-13 10:37:30 -07:00
parent d313ddbd3d
commit a48968c1ce
No known key found for this signature in database
GPG key ID: FB94249299E904FE

View file

@ -36,11 +36,14 @@ const vstsArmJobs = [
let jobRequestedCount = 0;
async function makeRequest ({ auth, url, headers, body, method }) {
const response = await got(url, {
headers: {
Authorization: auth && auth.bearer ? `Bearer ${auth.bearer}` : undefined,
const clonedHeaders = {
...(headers || {})
},
};
if (auth && auth.bearer) {
clonedHeaders.Authorization = `Bearer ${auth.bearer}`;
}
const response = await got(url, {
headers: clonedHeaders,
body,
method,
auth: auth && auth.password ? `${auth.username}:${auth.password}` : undefined