Skip to content

Commit ea50f99

Browse files
committed
fix: updating the curl target to prioritize param.fileName
1 parent 89177c3 commit ea50f99

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/targets/shell/curl.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ module.exports = function (source, options) {
4444
switch (source.postData.mimeType) {
4545
case 'multipart/form-data':
4646
source.postData.params.map(function (param) {
47-
var post = util.format('%s=%s', param.name, param.value)
48-
49-
if (param.fileName && !param.value) {
47+
var post = ''
48+
if (param.fileName) {
5049
post = util.format('%s=@%s', param.name, param.fileName)
50+
} else {
51+
post = util.format('%s=%s', param.name, param.value)
5152
}
5253

5354
code.push('%s %s', opts.short ? '-F' : '--form', helpers.quote(post))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
curl --request POST \
22
--url http://mockbin.com/har \
33
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
4-
--form 'foo=Hello World'
4+
--form foo=@hello.txt

0 commit comments

Comments
 (0)