Skip to content

Commit 5861996

Browse files
author
Arthur Cinader
committed
explicitly check if auth keys are undefined
Simply checking if they are truthy causes a false negative if the value is ''.
1 parent ca70ad0 commit 5861996

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/middlewares.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ export function handleParseHeaders(req, res, next) {
122122
// to preserve original behavior.
123123
const keys = ["clientKey", "javascriptKey", "dotNetKey", "restAPIKey"];
124124
const oneKeyConfigured = keys.some(function(key) {
125-
return req.config[key];
125+
return req.config[key] !== undefined;
126126
});
127127
const oneKeyMatches = keys.some(function(key){
128-
return req.config[key] && info[key] == req.config[key];
128+
return req.config[key] !== undefined && info[key] === req.config[key];
129129
});
130130

131131
if (oneKeyConfigured && !oneKeyMatches) {

0 commit comments

Comments
 (0)