Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Commit ff5ab72

Browse files
authored
Merge pull request #1 from confluentinc/acheng/fix-multipart-curl
Fixed curl to not error out if params is nil
2 parents d49e64b + f9a58f3 commit ff5ab72

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/targets/shell/curl.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,18 @@ module.exports = function (source, options) {
4343
// construct post params
4444
switch (source.postData.mimeType) {
4545
case 'multipart/form-data':
46-
source.postData.params.map(function (param) {
47-
var post = ''
48-
if (param.fileName) {
49-
post = util.format('%s=@%s', param.name, param.fileName)
50-
} else {
51-
post = util.format('%s=%s', param.name, param.value)
52-
}
46+
if (source.postData.params) {
47+
source.postData.params.map(function (param) {
48+
var post = ''
49+
if (param.fileName) {
50+
post = util.format('%s=@%s', param.name, param.fileName)
51+
} else {
52+
post = util.format('%s=%s', param.name, param.value)
53+
}
5354

54-
code.push('%s %s', opts.short ? '-F' : '--form', helpers.quote(post))
55-
})
55+
code.push('%s %s', opts.short ? '-F' : '--form', helpers.quote(post))
56+
})
57+
}
5658
break
5759

5860
case 'application/x-www-form-urlencoded':

0 commit comments

Comments
 (0)