more feed tests

This commit is contained in:
Barış Soner Uşaklı
2017-05-21 19:45:25 -04:00
parent 57c5e0b554
commit a4ba88dc60
3 changed files with 252 additions and 149 deletions

View File

@@ -30,18 +30,20 @@ exports.handle404 = function (req, res) {
}
meta.errors.log404(req.path.replace(/^\/api/, '') || '');
res.status(404);
var path = String(req.path || '');
if (res.locals.isAPI) {
return res.json({ path: validator.escape(path.replace(/^\/api/, '')), title: '[[global:404.title]]' });
}
var middleware = require('../middleware');
middleware.buildHeader(req, res, function () {
res.render('404', { path: validator.escape(path), title: '[[global:404.title]]' });
});
exports.send404(req, res);
} else {
res.status(404).type('txt').send('Not found');
}
};
exports.send404 = function (req, res) {
res.status(404);
var path = String(req.path || '');
if (res.locals.isAPI) {
return res.json({ path: validator.escape(path.replace(/^\/api/, '')), title: '[[global:404.title]]' });
}
var middleware = require('../middleware');
middleware.buildHeader(req, res, function () {
res.render('404', { path: validator.escape(path), title: '[[global:404.title]]' });
});
};