Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit b67810a

Browse files
committed
fix(webdriver-manager): do not download files if HTTP response is not 200
Closes #656
1 parent 28912f0 commit b67810a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bin/webdriver-manager

+5-3
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@ var httpGetFile = function(fileUrl, fileName, outputDir, callback) {
118118
path: url.parse(fileUrl).pathname
119119
};
120120

121-
var filePath = path.join(outputDir, fileName);
122-
var file = fs.createWriteStream(filePath);
123-
124121
http.get(options, function(res) {
122+
if (res.statusCode !== 200) {
123+
throw new Error('Got code ' + res.statusCode + ' from ' + fileUrl);
124+
}
125+
var filePath = path.join(outputDir, fileName);
126+
var file = fs.createWriteStream(filePath);
125127
res.on('data', function(data) {
126128
file.write(data);
127129
}).on('end', function() {

0 commit comments

Comments
 (0)