mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-02 08:56:11 +00:00
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 Web3 = require('web3');
|
||||||
let utils = require('../utils/utils.js');
|
let utils = require('../utils/utils.js');
|
||||||
let Events = require('./events.js');
|
let Events = require('./events.js');
|
||||||
@ -181,7 +180,7 @@ class Engine {
|
|||||||
//Ideally this method should be in an IPFS API JSONRPC wrapper
|
//Ideally this method should be in an IPFS API JSONRPC wrapper
|
||||||
//The URL should also be flexible to accept non-default IPFS url
|
//The URL should also be flexible to accept non-default IPFS url
|
||||||
self.logger.trace("Checking IPFS version...");
|
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 = '';
|
let body = '';
|
||||||
res.on('data', function (d) {
|
res.on('data', function (d) {
|
||||||
body += d;
|
body += d;
|
||||||
|
@ -29,6 +29,10 @@ function checkIsAvailable(url, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function httpGet(url, callback) {
|
||||||
|
return http.get(url, callback);
|
||||||
|
}
|
||||||
|
|
||||||
function runCmd(cmd, options) {
|
function runCmd(cmd, options) {
|
||||||
let result = shelljs.exec(cmd, options || {silent: true});
|
let result = shelljs.exec(cmd, options || {silent: true});
|
||||||
if (result.code !== 0) {
|
if (result.code !== 0) {
|
||||||
@ -60,6 +64,7 @@ module.exports = {
|
|||||||
fileMatchesPattern: fileMatchesPattern,
|
fileMatchesPattern: fileMatchesPattern,
|
||||||
recursiveMerge: recursiveMerge,
|
recursiveMerge: recursiveMerge,
|
||||||
checkIsAvailable: checkIsAvailable,
|
checkIsAvailable: checkIsAvailable,
|
||||||
|
httpGet: httpGet,
|
||||||
runCmd: runCmd,
|
runCmd: runCmd,
|
||||||
cd: cd,
|
cd: cd,
|
||||||
sed: sed,
|
sed: sed,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user