chore: Check for http error status codes including 400

This commit is contained in:
Susmitha Girumala committed 2021-08-03 13:16:10 -04:00
1 parent a19aa2ff0c
commit 76e721bd91
1 file changed
+1 -1
+1 -1
View File
@@ -33,7 +33,7 @@ const downloadArtifact = (version) => {
const artifactPath = path.resolve(tmpDir, artifactFileName);
console.log('Download artifact url: ', url);
https.get(url, (response) => {
if (response.statusCode > 400) reject('Could not access artifact url.');
if (response.statusCode >= 400) reject('Could not access artifact url.');
const stream = response.pipe(fs.createWriteStream(artifactPath));
stream.on('close', () => resolve(artifactPath));
stream.on('error', reject);