Skip to content

Commit

Permalink
fix req_end issue
Browse files Browse the repository at this point in the history
  • Loading branch information
NickOvt committed May 6, 2024
1 parent 028e173 commit a917584
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,17 @@ const serverOptions = {
};

Object.keys(req.params || {}).forEach(key => {
// cast value to string, as we want to have value present whenever there is some actual value (whatever the data type)
let value = typeof req.params[key] === 'string' ? req.params[key] : util.inspect(req.params[key], false, 3).trim();
let value = req.params[key];

if (!value) {
// check for empty string
if (!value && value !== 0) {
// if falsy don't continue, allow 0 integer as value
return;
}

if (['password'].includes(key)) {
value = '***';
} else if (value.length > 128) {
value = value.substr(0, 128) + '…';
} else if (key === 'end') {
// in case param name is end
if (key.includes('false')) {
// end is false (boolean as string)
return;
}
}

if (key.length > 30) {
Expand Down

0 comments on commit a917584

Please sign in to comment.