From 6a45e00a4cc7798c40bcdcca326fdc511c0429d1 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Fri, 15 Jul 2016 12:05:32 -0300 Subject: [PATCH] warn deprecated method invoked --- lib/expressapp.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/expressapp.js b/lib/expressapp.js index ca0e8fe..9d70ebd 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -103,6 +103,10 @@ ExpressApp.prototype.start = function(opts, cb) { } }; + function logDeprecated(req) { + log.warn('DEPRECATED', req.method, req.url, '(' + req.header('x-client-version') + ')'); + }; + function getCredentials(req) { var identity = req.header('x-identity'); if (!identity) return; @@ -146,6 +150,7 @@ ExpressApp.prototype.start = function(opts, cb) { // DEPRECATED router.post('/v1/wallets/', function(req, res) { + logDeprecated(req); var server = getServer(req, res); req.body.supportBIP44AndP2PKH = false; server.createWallet(req.body, function(err, walletId) { @@ -177,6 +182,7 @@ ExpressApp.prototype.start = function(opts, cb) { // DEPRECATED router.post('/v1/wallets/:id/copayers/', function(req, res) { + logDeprecated(req); req.body.walletId = req.params['id']; req.body.supportBIP44AndP2PKH = false; var server = getServer(req, res); @@ -199,6 +205,7 @@ ExpressApp.prototype.start = function(opts, cb) { // DEPRECATED router.get('/v1/wallets/', function(req, res) { + logDeprecated(req); getServerWithAuth(req, res, function(server) { server.getStatus({ includeExtendedInfo: true @@ -251,6 +258,7 @@ ExpressApp.prototype.start = function(opts, cb) { router.post('/v1/txproposals/', function(req, res) { + log.warn('DEPRECATED v1/txproposals'); getServerWithAuth(req, res, function(server) { server.createTxLegacy(req.body, function(err, txp) { if (err) return returnError(err, res, req); @@ -270,6 +278,7 @@ ExpressApp.prototype.start = function(opts, cb) { // DEPRECATED router.post('/v1/addresses/', function(req, res) { + logDeprecated(req); getServerWithAuth(req, res, function(server) { server.createAddress({ ignoreMaxGap: true @@ -282,6 +291,7 @@ ExpressApp.prototype.start = function(opts, cb) { // DEPRECATED router.post('/v2/addresses/', function(req, res) { + logDeprecated(req); getServerWithAuth(req, res, function(server) { server.createAddress({ ignoreMaxGap: true @@ -327,6 +337,7 @@ ExpressApp.prototype.start = function(opts, cb) { // DEPRECATED router.get('/v1/feelevels/', function(req, res) { + logDeprecated(req); var opts = {}; if (req.query.network) opts.network = req.query.network; var server = getServer(req, res);