@mbtest/mountebank 2.9.3-beta.9551 → 2.9.3-beta.9572
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/models/xpath.js +13 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbtest/mountebank",
|
|
3
|
-
"version": "2.9.3-beta.
|
|
3
|
+
"version": "2.9.3-beta.9572",
|
|
4
4
|
"author": "Brandon Byars <brandon.byars@gmail.com>",
|
|
5
5
|
"description": "Over the wire test doubles",
|
|
6
6
|
"homepage": "http://www.mbtest.dev",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"service virtualization"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@xmldom/xmldom": "0.8
|
|
44
|
+
"@xmldom/xmldom": "0.9.8",
|
|
45
45
|
"cors": "2.8.5",
|
|
46
46
|
"csv-parse": "5.6.0",
|
|
47
47
|
"ejs": "3.1.10",
|
package/src/models/xpath.js
CHANGED
|
@@ -68,13 +68,22 @@ function nodeValue (node) {
|
|
|
68
68
|
function select (selector, ns, possibleXML, logger) {
|
|
69
69
|
const DOMParser = xmlDom.DOMParser,
|
|
70
70
|
parser = new DOMParser({
|
|
71
|
-
|
|
71
|
+
onError: (level, message) => {
|
|
72
72
|
const warn = (logger || {}).warn || (() => {});
|
|
73
73
|
warn('%s (source: %s)', message, JSON.stringify(possibleXML));
|
|
74
74
|
}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
let doc;
|
|
78
|
+
try {
|
|
79
|
+
doc = parser.parseFromString(possibleXML, 'text/xml');
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
// Invalid XML, return undefined to indicate no match
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const selectFn = xpath.useNamespaces(ns || {}),
|
|
78
87
|
result = xpathSelect(selectFn, selector, doc);
|
|
79
88
|
let nodeValues;
|
|
80
89
|
|