From e535ba5c89c1b24131b23c3de20738856d9c2f57 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Thu, 19 Oct 2023 10:05:24 +0200 Subject: [PATCH 1/2] Update HTTPBinding.js --- lib/bindings/HTTPBinding.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/bindings/HTTPBinding.js b/lib/bindings/HTTPBinding.js index 28ce8068d..74fec43d6 100644 --- a/lib/bindings/HTTPBinding.js +++ b/lib/bindings/HTTPBinding.js @@ -128,9 +128,12 @@ function parseData(req, res, next) { next(error); } else { req.jsonPayload = data; - // This is just for log data if (req.body !== undefined) { - data = data.toString('hex'); + try { + // This is just for log data + data = data.toString('hex'); + } catch (e) { + } } config.getLogger().debug(context, 'Parsed data: %j', data); next(); @@ -294,7 +297,10 @@ function handleIncomingMeasure(req, res, next) { if (req.attr && req.jsonPayload) { config.getLogger().debug(context, 'Parsing attr %s with value %s', req.attr, req.jsonPayload); - req.jsonPayload = req.jsonPayload.toString('hex'); + try { + req.jsonPayload = req.jsonPayload.toString('hex'); + } catch (e) { + } const theAttr = [{ name: req.attr, value: req.jsonPayload, type: 'None' }]; attributeArr.push(theAttr); } else { From fe3fc233564fd28a25b2b4d4b56b32f9d62e9e59 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Thu, 19 Oct 2023 10:09:14 +0200 Subject: [PATCH 2/2] Update HTTPBinding.js --- lib/bindings/HTTPBinding.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bindings/HTTPBinding.js b/lib/bindings/HTTPBinding.js index 74fec43d6..d907a238a 100644 --- a/lib/bindings/HTTPBinding.js +++ b/lib/bindings/HTTPBinding.js @@ -133,6 +133,7 @@ function parseData(req, res, next) { // This is just for log data data = data.toString('hex'); } catch (e) { + // no error should be reported } } config.getLogger().debug(context, 'Parsed data: %j', data); @@ -300,6 +301,7 @@ function handleIncomingMeasure(req, res, next) { try { req.jsonPayload = req.jsonPayload.toString('hex'); } catch (e) { + // no error should be reported } const theAttr = [{ name: req.attr, value: req.jsonPayload, type: 'None' }]; attributeArr.push(theAttr);