diff --git a/lib/core/engine.js b/lib/core/engine.js index 9b1795c3..2edc10a4 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -1,4 +1,3 @@ -let http = require('http'); let Web3 = require('web3'); let utils = require('../utils/utils.js'); let Events = require('./events.js'); @@ -181,7 +180,7 @@ class Engine { //Ideally this method should be in an IPFS API JSONRPC wrapper //The URL should also be flexible to accept non-default IPFS url self.logger.trace("Checking IPFS version..."); - http.get('http://localhost:5001/api/v0/version', function (res) { + utils.httpGet('http://localhost:5001/api/v0/version', function (res) { let body = ''; res.on('data', function (d) { body += d; diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 8828cd31..3460f181 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -29,6 +29,10 @@ function checkIsAvailable(url, callback) { }); } +function httpGet(url, callback) { + return http.get(url, callback); +} + function runCmd(cmd, options) { let result = shelljs.exec(cmd, options || {silent: true}); if (result.code !== 0) { @@ -60,6 +64,7 @@ module.exports = { fileMatchesPattern: fileMatchesPattern, recursiveMerge: recursiveMerge, checkIsAvailable: checkIsAvailable, + httpGet: httpGet, runCmd: runCmd, cd: cd, sed: sed,