artillery-core
Advanced tools
Comparing version 1.6.0-0 to 1.6.0
@@ -20,4 +20,9 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
const fs = require('fs'); | ||
const xml = require('libxmljs'); | ||
let xmlCapture = null; | ||
try { | ||
xmlCapture = require('artillery-xml-capture'); | ||
} catch (e) { | ||
} | ||
module.exports = HttpEngine; | ||
@@ -134,5 +139,5 @@ | ||
extractor = extractJSONPath; | ||
} else if ((params.capture && params.capture.xpath) || (params.match && params.match.xpath)) { | ||
parser = parseXML; | ||
extractor = extractXPath; | ||
} else if (xmlCapture && (params.capture && params.capture.xpath) || (params.match && params.match.xpath)) { | ||
parser = xmlCapture.parseXML; | ||
extractor = xmlCapture.extractXPath; | ||
} else if ((params.capture && params.capture.regexp) || (params.match && params.match.regexp)) { | ||
@@ -145,5 +150,5 @@ parser = dummyParser; | ||
extractor = extractJSONPath; | ||
} else if (isXML(res)) { | ||
parser = parseXML; | ||
extractor = extractXPath; | ||
} else if (xmlCapture && isXML(res)) { | ||
parser = xmlCapture.parseXML; | ||
extractor = xmlCapture.extractXPath; | ||
} else { | ||
@@ -330,14 +335,2 @@ // We really don't know what to do here. | ||
/* | ||
* Wrap XML parser in a callback | ||
*/ | ||
function parseXML(body, callback) { | ||
try { | ||
let doc = xml.parseXml(body); | ||
return callback(null, doc); | ||
} catch(err) { | ||
return callback(err, null); | ||
} | ||
} | ||
function dummyParser(body, callback) { | ||
@@ -357,8 +350,2 @@ return callback(null, body); | ||
// doc is an libxmljs document object | ||
function extractXPath(doc, expr) { | ||
let result = doc.get(expr).text(); | ||
return result; | ||
} | ||
// doc is a string or an object (body parsed by Request when headers indicate JSON) | ||
@@ -365,0 +352,0 @@ function extractRegExp(doc, expr) { |
{ | ||
"name": "artillery-core", | ||
"version": "1.6.0-0", | ||
"version": "1.6.0", | ||
"description": "core load-generating functionality of Artillery", | ||
@@ -54,3 +54,6 @@ "main": "index.js", | ||
"is_linted" | ||
] | ||
], | ||
"optionalDependencies": { | ||
"artillery-xml-capture": "^1.0.0" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
57126
15
1208