Skip to content

Commit d3b6a63

Browse files
authored
chore: remove usage of undefined return value (#5)
PR-URL: #5
1 parent b05baf8 commit d3b6a63

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ module.exports = function basicAuth(callback, realm) {
6363
var authorization = req.headers.authorization;
6464

6565
if (req.user) return next();
66-
if (!authorization) return unauthorized(res, realm);
66+
if (!authorization) {
67+
unauthorized(res, realm);
68+
return;
69+
}
6770

6871
var parts = authorization.split(' ');
6972

@@ -81,7 +84,10 @@ module.exports = function basicAuth(callback, realm) {
8184
// async
8285
if (callback.length >= 3) {
8386
callback(user, pass, function(err, user){
84-
if (err || !user) return unauthorized(res, realm);
87+
if (err || !user) {
88+
unauthorized(res, realm);
89+
return;
90+
}
8591
req.user = req.remoteUser = user;
8692
next();
8793
});

0 commit comments

Comments
 (0)