From be45ad163a65969970cec373b8052be16b674995 Mon Sep 17 00:00:00 2001
From: Julian Lam <julian@designcreateplay.com>
Date: Wed, 26 Mar 2014 11:43:42 -0400
Subject: [PATCH] properly fixed #1274

---
 src/controllers/static.js | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/controllers/static.js b/src/controllers/static.js
index d689236137..af4f43f168 100644
--- a/src/controllers/static.js
+++ b/src/controllers/static.js
@@ -1,12 +1,9 @@
 "use strict";
 
-var staticController = {},
-	isApi = function(path) {
-		return !!path.match('api');
-	};
+var staticController = {};
 
 staticController['404'] = function(req, res, next) {
-	if (!isApi(req.path)) {
+	if (!res.locals.isAPI) {
 		res.statusCode = 404;
 	}
 
@@ -14,7 +11,7 @@ staticController['404'] = function(req, res, next) {
 };
 
 staticController['403'] = function(req, res, next) {
-	if (!isApi(req.path)) {
+	if (!res.locals.isAPI) {
 		res.statusCode = 403;
 	}
 
@@ -22,7 +19,7 @@ staticController['403'] = function(req, res, next) {
 };
 
 staticController['500'] = function(req, res, next) {
-	if (!isApi(req.path)) {
+	if (!res.locals.isAPI) {
 		res.statusCode = 500;
 	}