From 6f7a41ca052e718432c42d377837a5de421167dc Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Mon, 13 Nov 2023 09:14:32 +0100 Subject: [PATCH] Update lib/bindings/HTTPBinding.js Co-authored-by: rg2011 <52279456+rg2011@users.noreply.github.com> --- lib/bindings/HTTPBinding.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/bindings/HTTPBinding.js b/lib/bindings/HTTPBinding.js index 40a26125c..1f80859d0 100644 --- a/lib/bindings/HTTPBinding.js +++ b/lib/bindings/HTTPBinding.js @@ -54,7 +54,19 @@ const { promisify } = require('util'); const json = promisify(bodyParser.json({ strict: false })); // accept anything JSON.parse accepts. const text = promisify(bodyParser.text()); const raw = promisify(bodyParser.raw()); -const xml = promisify(bodyParser.xml()); +const xml2js = require('xml2js'); +const xmlStripPrefix = xml2js.processors.stripPrefix; +const xml = promisify(bodyParser.xml({ + xmlParseOptions: { + // XML namespaces might change from one request to the next. + // It is useful to remove them from the document, + // to be able to refer to tags later in JEXL transformations. + // See https://github.com/Leonidas-from-XIV/node-xml2js/issues/87 + tagNameProcessors: [xmlStripPrefix], + attrNameProcessors: [xmlStripPrefix] + } + }) +); function parserBody() { // generic bodyParser