From ca57ea4897cf0b9bdcac08593005dd54c195c982 Mon Sep 17 00:00:00 2001 From: NickOvt Date: Thu, 9 May 2024 11:11:59 +0300 Subject: [PATCH] fix(api-req_end): req_end issue fix ZMS-147 (#681) * Added submission api endpoint to api docs generation * req_end not included in graylog if value is false * fix req_end issue * cast value to string after first check --- api.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api.js b/api.js index f8d1cdca..8ea5ee53 100644 --- a/api.js +++ b/api.js @@ -101,12 +101,16 @@ const serverOptions = { }; Object.keys(req.params || {}).forEach(key => { - let value = typeof req.params[key] === 'string' ? req.params[key] : util.inspect(req.params[key], false, 3).toString().trim(); + let value = req.params[key]; - if (!value) { + if (!value && value !== 0) { + // if falsy don't continue, allow 0 integer as value return; } + // cast value to string + value = util.inspect(req.params[key], false, 3).trim(); + if (['password'].includes(key)) { value = '***'; } else if (value.length > 128) {