explicitly check if auth keys are undefined

Simply checking if they are truthy causes a false negative
if the value is ''.
This commit is contained in:
Arthur Cinader
2017-02-09 15:20:10 -08:00
parent ca70ad0141
commit 5861996cb0

View File

@@ -122,10 +122,10 @@ export function handleParseHeaders(req, res, next) {
// to preserve original behavior.
const keys = ["clientKey", "javascriptKey", "dotNetKey", "restAPIKey"];
const oneKeyConfigured = keys.some(function(key) {
return req.config[key];
return req.config[key] !== undefined;
});
const oneKeyMatches = keys.some(function(key){
return req.config[key] && info[key] == req.config[key];
return req.config[key] !== undefined && info[key] === req.config[key];
});
if (oneKeyConfigured && !oneKeyMatches) {