From 585eb9e1be780f0a40b07b4f15a0404baefb35d1 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 26 Mar 2014 11:39:27 -0400 Subject: [PATCH] fixed #1274 --- src/controllers/static.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) 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