From fd1d285a77db1c583be3e42fb1929ecd4dd41633 Mon Sep 17 00:00:00 2001 From: Tom Hunkapiller Date: Fri, 10 Apr 2015 14:10:55 -0500 Subject: [PATCH] fix the rest of the deprecation warnings --- src/node/handler/ImportHandler.js | 2 +- src/node/hooks/express/errorhandling.js | 4 ++-- src/node/hooks/express/padreadonly.js | 2 +- src/node/hooks/express/padurlsanitize.js | 4 ++-- src/node/hooks/i18n.js | 2 +- src/node/padaccess.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 2dad8b3d8..ba6f4415a 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -303,7 +303,7 @@ exports.doImport = function(req, res, padId) var impexp = window.parent.padimpexp.handleFrameCall('" + directDatabaseAccess +"', '" + status + "'); \ }) \ " - , 200); + ); }); } diff --git a/src/node/hooks/express/errorhandling.js b/src/node/hooks/express/errorhandling.js index 087dd50eb..7afe80aeb 100644 --- a/src/node/hooks/express/errorhandling.js +++ b/src/node/hooks/express/errorhandling.js @@ -39,7 +39,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { // if an error occurs Connect will pass it down // through these "error-handling" middleware // allowing you to respond however you like - res.send(500, { error: 'Sorry, something bad happened!' }); + res.status(500).send({ error: 'Sorry, something bad happened!' }); console.error(err.stack? err.stack : err.toString()); stats.meter('http500').mark() }) @@ -50,4 +50,4 @@ exports.expressCreateServer = function (hook_name, args, cb) { //https://github.com/joyent/node/issues/1553 process.on('SIGINT', exports.gracefulShutdown); } -} \ No newline at end of file +} diff --git a/src/node/hooks/express/padreadonly.js b/src/node/hooks/express/padreadonly.js index d60d38633..66be33390 100644 --- a/src/node/hooks/express/padreadonly.js +++ b/src/node/hooks/express/padreadonly.js @@ -55,7 +55,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { ERR(err); if(err == "notfound") - res.send(404, '404 - Not Found'); + res.status(404).send('404 - Not Found'); else res.send(html); }); diff --git a/src/node/hooks/express/padurlsanitize.js b/src/node/hooks/express/padurlsanitize.js index 2aadccdc6..94cbe36a1 100644 --- a/src/node/hooks/express/padurlsanitize.js +++ b/src/node/hooks/express/padurlsanitize.js @@ -7,7 +7,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { //ensure the padname is valid and the url doesn't end with a / if(!padManager.isValidPadId(padId) || /\/$/.test(req.url)) { - res.send(404, 'Such a padname is forbidden'); + res.status(404).send('Such a padname is forbidden'); } else { @@ -19,7 +19,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { var query = url.parse(req.url).query; if ( query ) real_url += '?' + query; res.header('Location', real_url); - res.send(302, 'You should be redirected to ' + real_url + ''); + res.status(302).send('You should be redirected to ' + real_url + ''); } //the pad id was fine, so just render it else diff --git a/src/node/hooks/i18n.js b/src/node/hooks/i18n.js index 678156596..1d28b5447 100644 --- a/src/node/hooks/i18n.js +++ b/src/node/hooks/i18n.js @@ -91,7 +91,7 @@ exports.expressCreateServer = function(n, args) { res.setHeader('Content-Type', 'application/json; charset=utf-8'); res.send('{"'+locale+'":'+JSON.stringify(locales[locale])+'}'); } else { - res.send(404, 'Language not available'); + res.status(404).send('Language not available'); } }) diff --git a/src/node/padaccess.js b/src/node/padaccess.js index d87809149..973335148 100644 --- a/src/node/padaccess.js +++ b/src/node/padaccess.js @@ -15,7 +15,7 @@ module.exports = function (req, res, callback) { callback(); //no access } else { - res.send(403, "403 - Can't touch this"); + res.status(403).send("403 - Can't touch this"); } }); }