move http request to utils
This commit is contained in:
parent
2373d14d6b
commit
86335e0c74
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue