Fix res.send (migrate to express v3)

This commit is contained in:
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: [],
};
res.send(eejs.require(
"ep_etherpad-lite/templates/admin/plugins.html",
render_args), {});
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins.html", render_args) );
});
args.app.get('/admin/plugins/info', function(req, res) {
res.send(eejs.require(
"ep_etherpad-lite/templates/admin/plugins-info.html",
{}), {});
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins-info.html", {}) );
});
}

View file

@ -56,7 +56,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
ERR(err);
if(err == "notfound")
res.send('404 - Not Found', 404);
res.send(404, '404 - Not Found');
else
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 /
if(!padManager.isValidPadId(padId) || /\/$/.test(req.url))
{
res.send('Such a padname is forbidden', 404);
res.send(404, '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('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
else

View file

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

View file

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