properly fixed #1274

v1.18.x
Julian Lam 11 years ago
parent 585eb9e1be
commit be45ad163a

@ -1,12 +1,9 @@
"use strict"; "use strict";
var staticController = {}, var staticController = {};
isApi = function(path) {
return !!path.match('api');
};
staticController['404'] = function(req, res, next) { staticController['404'] = function(req, res, next) {
if (!isApi(req.path)) { if (!res.locals.isAPI) {
res.statusCode = 404; res.statusCode = 404;
} }
@ -14,7 +11,7 @@ staticController['404'] = function(req, res, next) {
}; };
staticController['403'] = function(req, res, next) { staticController['403'] = function(req, res, next) {
if (!isApi(req.path)) { if (!res.locals.isAPI) {
res.statusCode = 403; res.statusCode = 403;
} }
@ -22,7 +19,7 @@ staticController['403'] = function(req, res, next) {
}; };
staticController['500'] = function(req, res, next) { staticController['500'] = function(req, res, next) {
if (!isApi(req.path)) { if (!res.locals.isAPI) {
res.statusCode = 500; res.statusCode = 500;
} }

Loading…
Cancel
Save