@artilleryio/int-core
Advanced tools
Comparing version 2.11.0 to 2.12.0-c3be075
@@ -26,2 +26,4 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
const decompressResponse = require('decompress-response'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
@@ -399,2 +401,3 @@ const { promisify } = require('node:util'); | ||
if (params.formData) { | ||
let fileUpload; | ||
const f = new FormData(); | ||
@@ -404,4 +407,12 @@ requestParams.body = _.reduce( | ||
function (acc, v, k) { | ||
// acc[k] = template(v, context); | ||
acc.append(k, template(v, context)); | ||
let V = template(v, context); | ||
if (V && _.isPlainObject(V) && V.fromFile) { | ||
const absPath = path.resolve( | ||
path.dirname(context.vars.$scenarioFile), | ||
V.fromFile | ||
); | ||
fileUpload = absPath; | ||
V = fs.createReadStream(absPath); | ||
} | ||
acc.append(k, V); | ||
return acc; | ||
@@ -411,2 +422,11 @@ }, | ||
); | ||
if (params.setContentLengthHeader && fileUpload) { | ||
try { | ||
requestParams.headers = requestParams.headers || {}; | ||
requestParams.headers['content-length'] = | ||
fs.statSync(fileUpload).size; | ||
} catch (err) { | ||
debug(`stat() on ${fileUpload} failed with ${err}`); | ||
} | ||
} | ||
} | ||
@@ -413,0 +433,0 @@ |
@@ -471,3 +471,5 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
} | ||
if (script._scriptPath) { | ||
INITIAL_CONTEXT.vars.$scenarioFile = script._scriptPath; | ||
} | ||
let result = INITIAL_CONTEXT; | ||
@@ -474,0 +476,0 @@ |
{ | ||
"name": "@artilleryio/int-core", | ||
"version": "2.11.0", | ||
"version": "2.12.0-c3be075", | ||
"main": "./index.js", | ||
"license": "MPL-2.0", | ||
"dependencies": { | ||
"@artilleryio/int-commons": "2.7.0", | ||
"@artilleryio/int-commons": "2.8.0-c3be075", | ||
"@artilleryio/sketches-js": "^2.1.1", | ||
@@ -9,0 +9,0 @@ "agentkeepalive": "^4.1.0", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
120802
3063
2
15
+ Added@artilleryio/int-commons@2.8.0-c3be075(transitive)
- Removed@artilleryio/int-commons@2.7.0(transitive)