Skip to content

Commit

Permalink
fix axios requests, non 2xx requests reject by default
Browse files Browse the repository at this point in the history
  • Loading branch information
delanni committed May 2, 2024
1 parent b694a89 commit d1f8c01
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions .buildkite/scripts/steps/artifacts/validate_cdn_assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,22 @@ async function main() {

async function headAssetUrl(assetPath: string) {
const testUrl = `${CDN_URL_PREFIX}/${assetPath}`;
const response = await axios.head(testUrl, {
timeout: 1000,
});
return {
status: response.status,
testUrl,
assetPath,
};
try {
const response = await axios.head(testUrl, {
timeout: 1000,
});
return {
status: response.status,
testUrl,
assetPath,
};
} catch (error) {
return {
status: error.response?.status || 0,
testUrl,
assetPath,
};
}
}

async function headAssetUrlWithRetry(
Expand Down

0 comments on commit d1f8c01

Please sign in to comment.