@artilleryio/int-core 2.14.0 → 2.15.0-df428ce
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/lib/engine_http.js +44 -8
- package/lib/runner.js +9 -9
- package/package.json +2 -2
package/lib/engine_http.js
CHANGED
|
@@ -403,15 +403,23 @@ HttpEngine.prototype.step = function step(requestSpec, ee, opts) {
|
|
|
403
403
|
requestParams.formData,
|
|
404
404
|
function (acc, v, k) {
|
|
405
405
|
let V = template(v, context);
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
V.
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
406
|
+
let options;
|
|
407
|
+
if (V && _.isPlainObject(V)) {
|
|
408
|
+
if (V.contentType) {
|
|
409
|
+
options = { contentType: V.contentType };
|
|
410
|
+
}
|
|
411
|
+
if (V.fromFile) {
|
|
412
|
+
const absPath = path.resolve(
|
|
413
|
+
path.dirname(context.vars.$scenarioFile),
|
|
414
|
+
V.fromFile
|
|
415
|
+
);
|
|
416
|
+
fileUpload = absPath;
|
|
417
|
+
V = fs.createReadStream(absPath);
|
|
418
|
+
} else if (V.value) {
|
|
419
|
+
V = V.value;
|
|
420
|
+
}
|
|
413
421
|
}
|
|
414
|
-
acc.append(k, V);
|
|
422
|
+
acc.append(k, V, options);
|
|
415
423
|
return acc;
|
|
416
424
|
},
|
|
417
425
|
f
|
|
@@ -815,6 +823,34 @@ HttpEngine.prototype._handleResponse = function (
|
|
|
815
823
|
ee.emit('counter', 'http.responses', 1);
|
|
816
824
|
// ee.emit('rate', 'http.response_rate');
|
|
817
825
|
ee.emit('histogram', 'http.response_time', res.timings.phases.firstByte);
|
|
826
|
+
|
|
827
|
+
const statusCode = res.statusCode;
|
|
828
|
+
if (statusCode >= 200 && statusCode < 300) {
|
|
829
|
+
ee.emit(
|
|
830
|
+
'histogram',
|
|
831
|
+
'http.response_time.2xx',
|
|
832
|
+
res.timings.phases.firstByte
|
|
833
|
+
);
|
|
834
|
+
} else if (statusCode >= 300 && statusCode < 400) {
|
|
835
|
+
ee.emit(
|
|
836
|
+
'histogram',
|
|
837
|
+
'http.response_time.3xx',
|
|
838
|
+
res.timings.phases.firstByte
|
|
839
|
+
);
|
|
840
|
+
} else if (statusCode >= 400 && statusCode < 500) {
|
|
841
|
+
ee.emit(
|
|
842
|
+
'histogram',
|
|
843
|
+
'http.response_time.4xx',
|
|
844
|
+
res.timings.phases.firstByte
|
|
845
|
+
);
|
|
846
|
+
} else if (statusCode >= 500 && statusCode < 600) {
|
|
847
|
+
ee.emit(
|
|
848
|
+
'histogram',
|
|
849
|
+
'http.response_time.5xx',
|
|
850
|
+
res.timings.phases.firstByte
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
|
|
818
854
|
if (this.extendedHTTPMetrics) {
|
|
819
855
|
ee.emit('histogram', 'http.dns', res.timings.phases.dns);
|
|
820
856
|
ee.emit('histogram', 'http.tcp', res.timings.phases.tcp);
|
package/lib/runner.js
CHANGED
|
@@ -407,23 +407,23 @@ function datafileVariables(script) {
|
|
|
407
407
|
let result = {};
|
|
408
408
|
if (script.config.payload) {
|
|
409
409
|
_.each(script.config.payload, function (el) {
|
|
410
|
-
//when loading all the csv, we don't set individual fields
|
|
411
410
|
if (!el.loadAll) {
|
|
411
|
+
// Load individual fields from the CSV into VU context variables
|
|
412
412
|
// If data = [] (i.e. the CSV file is empty, or only has headers and
|
|
413
413
|
// skipHeaders = true), then row could = undefined
|
|
414
414
|
let row = el.reader(el.data) || [];
|
|
415
415
|
_.each(el.fields, function (fieldName, j) {
|
|
416
416
|
result[fieldName] = row[j];
|
|
417
417
|
});
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (typeof el.name !== 'undefined') {
|
|
421
|
-
// Make the entire CSV available
|
|
422
|
-
result[el.name] = el.reader(el.data);
|
|
423
418
|
} else {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
419
|
+
if (typeof el.name !== 'undefined') {
|
|
420
|
+
// Make the entire CSV available
|
|
421
|
+
result[el.name] = el.reader(el.data);
|
|
422
|
+
} else {
|
|
423
|
+
console.log(
|
|
424
|
+
'WARNING: loadAll is set to true but no name is provided for the CSV data'
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
427
|
}
|
|
428
428
|
});
|
|
429
429
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artilleryio/int-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0-df428ce",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@artilleryio/int-commons": "2.
|
|
7
|
+
"@artilleryio/int-commons": "2.11.0-df428ce",
|
|
8
8
|
"@artilleryio/sketches-js": "^2.1.1",
|
|
9
9
|
"agentkeepalive": "^4.1.0",
|
|
10
10
|
"arrivals": "^2.1.2",
|