diff --git a/app.js b/app.js index f3cff14..83e88f5 100644 --- a/app.js +++ b/app.js @@ -63,7 +63,8 @@ app.use('/api', nodeapi.app); app.use('/', routes); app.use('/ext/getmoneysupply', function(req,res){ lib.get_supply(function(supply){ - res.send(' '+supply); + res.setHeader('content-type', 'text/plain'); + res.end(supply.toString()); }); }); @@ -87,7 +88,8 @@ app.use('/ext/getaddress/:hash', function(req,res){ app.use('/ext/getbalance/:hash', function(req,res){ db.get_address(req.params.hash, false, function(address){ if (address) { - res.send((address.balance / 100000000).toString().replace(/(^-+)/mg, '')); + res.setHeader('content-type', 'text/plain'); + res.end((address.balance / 100000000).toString().replace(/(^-+)/mg, '')); } else { res.send({ error: 'address not found.', hash: req.params.hash}) } diff --git a/lib/nodeapi.js b/lib/nodeapi.js index fd9b750..2d4459a 100644 --- a/lib/nodeapi.js +++ b/lib/nodeapi.js @@ -49,7 +49,8 @@ module.exports = function(){ res.json(response); } else{ - res.send(""+response); + res.setHeader('content-type', 'text/plain'); + res.end(response.toString()); } } });