build: fix release CI jobs start script (#30521)
This broke in #30492, we weren't handled 20X status codes and weren't authing to appveyor correctly.
This commit is contained in:
parent
17615654e8
commit
93b1d2d932
1 changed files with 6 additions and 3 deletions
|
@ -37,12 +37,15 @@ let jobRequestedCount = 0;
|
||||||
|
|
||||||
async function makeRequest ({ auth, url, headers, body, method }) {
|
async function makeRequest ({ auth, url, headers, body, method }) {
|
||||||
const response = await got(url, {
|
const response = await got(url, {
|
||||||
headers,
|
headers: {
|
||||||
|
Authorization: auth && auth.bearer ? `Bearer ${auth.bearer}` : undefined,
|
||||||
|
...(headers || {})
|
||||||
|
},
|
||||||
body,
|
body,
|
||||||
method,
|
method,
|
||||||
auth: auth ? `${auth.username}:${auth.password}` : undefined
|
auth: auth && auth.password ? `${auth.username}:${auth.password}` : undefined
|
||||||
});
|
});
|
||||||
if (response.statusCode !== 200) {
|
if (response.statusCode < 200 || response.statusCode >= 300) {
|
||||||
console.error('Error: ', `(status ${response.statusCode})`, response.body);
|
console.error('Error: ', `(status ${response.statusCode})`, response.body);
|
||||||
throw new Error(`Unexpected status code ${response.statusCode} from ${url}`);
|
throw new Error(`Unexpected status code ${response.statusCode} from ${url}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue