Skip to content

Commit

Permalink
Use request-stream over request-promise
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Feldman committed Aug 20, 2018
1 parent 14f9665 commit be88200
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 44 deletions.
42 changes: 10 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dependencies": {
"mustache": "^2.3.0",
"request": "^2.87.0",
"request-promise": "^4.2.0",
"request-stream": "1.2.2",
"tar": "^2.2.1",
"unzip-stream": "^0.3.0"
}
Expand Down
22 changes: 11 additions & 11 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var request = require("request-promise");
var request = require("request-stream");

// https://nodejs.org/api/os.html#os_os_platform
var validPlatforms = {
Expand Down Expand Up @@ -55,22 +55,22 @@ module.exports = function test(config) {
});
} else {
return p.then(function() {
return request({
method: "GET",
uri: url,
resolveWithFullResponse: true
})
.then(function(response) {
return new Promise(function(resolve, reject) {
request(url, {method: "GET"}, function(err, response) {
if (err) {
console.error(" - Failed to fetch " + url + " " + err.message);
errors.push(displayUrl);
return reject();
}

if (response.statusCode != 200) {
throw new Error("Status code " + response.statusCode);
} else {
console.log("OKAY: " + displayUrl);
resolve();
}
})
.catch(function(err) {
console.error(" - Failed to fetch " + url + " " + err.message);
errors.push(displayUrl);
});
});
});
}
},
Expand Down

0 comments on commit be88200

Please sign in to comment.