Skip to content

Commit 36a1a5b

Browse files
committed
fix: updating the node request target to prioritize param.fileName
1 parent ea50f99 commit 36a1a5b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/targets/node/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = function (source, options) {
6161
return
6262
}
6363

64-
if (param.fileName && !param.value) {
64+
if (param.fileName) {
6565
includeFS = true
6666

6767
attachment.value = 'fs.createReadStream("' + param.fileName + '")'

test/fixtures/output/node/request/multipart-data.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var fs = require("fs");
12
var request = require("request");
23

34
var options = {
@@ -6,7 +7,7 @@ var options = {
67
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
78
formData: {
89
foo: {
9-
value: 'Hello World',
10+
value: fs.createReadStream("hello.txt"),
1011
options: {filename: 'hello.txt', contentType: 'text/plain'}
1112
}
1213
}

0 commit comments

Comments
 (0)