Fix res.send (migrate to express v3)

pull/1020/head
Marcel Klehr 2012-09-22 13:51:39 +02:00
parent ff7cf991c9
commit 71579d1478
5 changed files with 8 additions and 12 deletions

View File

@ -12,14 +12,10 @@ exports.expressCreateServer = function (hook_name, args, cb) {
errors: [], errors: [],
}; };
res.send(eejs.require( res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins.html", render_args) );
"ep_etherpad-lite/templates/admin/plugins.html",
render_args), {});
}); });
args.app.get('/admin/plugins/info', function(req, res) { args.app.get('/admin/plugins/info', function(req, res) {
res.send(eejs.require( res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins-info.html", {}) );
"ep_etherpad-lite/templates/admin/plugins-info.html",
{}), {});
}); });
} }

View File

@ -56,7 +56,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
ERR(err); ERR(err);
if(err == "notfound") if(err == "notfound")
res.send('404 - Not Found', 404); res.send(404, '404 - Not Found');
else else
res.send(html); res.send(html);
}); });

View File

@ -7,7 +7,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//ensure the padname is valid and the url doesn't end with a / //ensure the padname is valid and the url doesn't end with a /
if(!padManager.isValidPadId(padId) || /\/$/.test(req.url)) if(!padManager.isValidPadId(padId) || /\/$/.test(req.url))
{ {
res.send('Such a padname is forbidden', 404); res.send(404, 'Such a padname is forbidden');
} }
else else
{ {
@ -19,7 +19,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
var query = url.parse(req.url).query; var query = url.parse(req.url).query;
if ( query ) real_url += '?' + query; if ( query ) real_url += '?' + query;
res.header('Location', real_url); res.header('Location', real_url);
res.send('You should be redirected to <a href="' + real_url + '">' + real_url + '</a>', 302); res.send(302, 'You should be redirected to <a href="' + real_url + '">' + real_url + '</a>');
} }
//the pad id was fine, so just render it //the pad id was fine, so just render it
else else

View File

@ -56,10 +56,10 @@ exports.basicAuth = function (req, res, next) {
res.header('WWW-Authenticate', 'Basic realm="Protected Area"'); res.header('WWW-Authenticate', 'Basic realm="Protected Area"');
if (req.headers.authorization) { if (req.headers.authorization) {
setTimeout(function () { setTimeout(function () {
res.send('Authentication required', 401); res.send(401, 'Authentication required');
}, 1000); }, 1000);
} else { } else {
res.send('Authentication required', 401); res.send(401, 'Authentication required');
} }
})); }));
} }

View File

@ -15,7 +15,7 @@ module.exports = function (req, res, callback) {
callback(); callback();
//no access //no access
} else { } else {
res.send("403 - Can't touch this", 403); res.send(403, "403 - Can't touch this");
} }
}); });
} }