From aaa0452bf7b97aa2939dcf66be0e6da462012294 Mon Sep 17 00:00:00 2001 From: Nicolas LaCasse Date: Fri, 5 Nov 2010 16:35:42 -0700 Subject: [PATCH] return to prevent errors when calling split on undfined --- lib/basicAuth.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/basicAuth.js b/lib/basicAuth.js index b49b5b9..f22b294 100644 --- a/lib/basicAuth.js +++ b/lib/basicAuth.js @@ -11,8 +11,9 @@ module.exports = function basicAuth(callback, realm) { return function(req, res, next) { var authorization = req.headers.authorization; - if (!authorization) - unauthorized(res); + if (!authorization) { + return unauthorized(res); + } var parts = authorization.split(" "); var scheme = parts[0];