diff --git a/src/controllers/static.js b/src/controllers/static.js index 8924ffaf6d..d689236137 100644 --- a/src/controllers/static.js +++ b/src/controllers/static.js @@ -1,17 +1,32 @@ "use strict"; -var staticController = {}; +var staticController = {}, + isApi = function(path) { + return !!path.match('api'); + }; staticController['404'] = function(req, res, next) { - res.status(404).render('404', {}); + if (!isApi(req.path)) { + res.statusCode = 404; + } + + res.render('404', {}); }; staticController['403'] = function(req, res, next) { - res.status(403).render('403', {}); + if (!isApi(req.path)) { + res.statusCode = 403; + } + + res.render('403', {}); }; staticController['500'] = function(req, res, next) { - res.status(500).render('500', {}); + if (!isApi(req.path)) { + res.statusCode = 500; + } + + res.render('500', {}); }; module.exports = staticController; \ No newline at end of file