diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 20952c705..d18b5b0a0 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -32,8 +32,8 @@ function checkIsAvailable(url, callback) { }); } -function httpGet(url, callback) { - http.get(url, function(res) { +function httpGetRequest(httpObj, url, callback) { + httpObj.get(url, function(res) { let body = ''; res.on('data', function (d) { body += d; @@ -47,19 +47,12 @@ function httpGet(url, callback) { }); } +function httpGet(url, callback) { + httpGetRequest(http, url, callback); +} + function httpsGet(url, callback) { - https.get(url, function(res) { - let body = ''; - res.on('data', function (d) { - body += d; - }); - res.on('end', function () { - callback(null, body); - }); - res.on('error', function (err) { - callback(err); - }); - }); + httpGetRequest(https, url, callback); } function runCmd(cmd, options) { diff --git a/test_app/npm-debug.log b/test_app/npm-debug.log deleted file mode 100644 index 9882b8146..000000000 --- a/test_app/npm-debug.log +++ /dev/null @@ -1,27 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ '/Users/iurimatias/.nvm/versions/node/v6.9.5/bin/node', -1 verbose cli '/Users/iurimatias/.nvm/versions/node/v6.9.5/bin/npm', -1 verbose cli 'run', -1 verbose cli 'fulltest' ] -2 info using npm@3.10.10 -3 info using node@v6.9.5 -4 verbose stack Error: missing script: fulltest -4 verbose stack at run (/Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/lib/run-script.js:151:19) -4 verbose stack at /Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/lib/run-script.js:61:5 -4 verbose stack at /Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/read-package-json/read-json.js:356:5 -4 verbose stack at checkBinReferences_ (/Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/read-package-json/read-json.js:320:45) -4 verbose stack at final (/Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/read-package-json/read-json.js:354:3) -4 verbose stack at then (/Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:5) -4 verbose stack at /Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/read-package-json/read-json.js:243:12 -4 verbose stack at /Users/iurimatias/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16 -4 verbose stack at tryToString (fs.js:455:3) -4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:442:12) -5 verbose cwd /Users/iurimatias/Projects/embark-framework/test_app -6 error Darwin 16.7.0 -7 error argv "/Users/iurimatias/.nvm/versions/node/v6.9.5/bin/node" "/Users/iurimatias/.nvm/versions/node/v6.9.5/bin/npm" "run" "fulltest" -8 error node v6.9.5 -9 error npm v3.10.10 -10 error missing script: fulltest -11 error If you need help, you may report this error at: -11 error -12 verbose exit [ 1, true ]