File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,7 +128,6 @@ HTTPSnippet.prototype.prepare = function (request) {
128128 var form = new MultiPartForm ( )
129129
130130 request . postData . params . forEach ( ( param ) => {
131- console . log ( param )
132131 form . append ( param . name , param . value || '' )
133132 } )
134133
@@ -139,7 +138,6 @@ HTTPSnippet.prototype.prepare = function (request) {
139138 // request.postData.boundary = this.getBoundary()
140139 // request.headersObj['content-type'] = 'multipart/form-data; boundary=' + this.getBoundary()
141140 request . headersObj [ 'content-type' ] = 'multipart/form-data'
142- console . log ( form )
143141 }
144142 break
145143
Original file line number Diff line number Diff line change @@ -64,19 +64,18 @@ module.exports = function (source, options) {
6464 var multipart = [ ]
6565
6666 source . postData . params . forEach ( function ( param ) {
67- console . log ( 'unirest.js 67' , param )
6867 var part = { }
69-
68+ const { name } = param || 'body'
7069 if ( param . fileName && ! param . value ) {
7170 includeFS = true
7271
73- part . body = 'fs.createReadStream("' + param . fileName + '")'
72+ part [ name ] = 'fs.createReadStream("' + param . fileName + '")'
7473 } else if ( param . value ) {
75- const { name } = param || 'body'
74+
7675 part [ name ] = param . value
7776 }
7877
79- if ( part . body ) {
78+ if ( part [ name ] ) {
8079 if ( param . contentType ) {
8180 part [ 'content-type' ] = param . contentType
8281 }
You can’t perform that action at this time.
0 commit comments