@@ -34,7 +34,7 @@ FormData.prototype.append = function(field, value, options) {
34
34
35
35
// all that streamy business can't handle numbers
36
36
if ( typeof value == 'number' ) {
37
- value = '' + value ;
37
+ value = '' + value ;
38
38
}
39
39
40
40
// https://github.com/felixge/node-form-data/issues/38
@@ -84,8 +84,7 @@ FormData.prototype._trackLength = function(header, value, options) {
84
84
}
85
85
86
86
// no need to bother with the length
87
- if ( ! options . knownLength )
88
- {
87
+ if ( ! options . knownLength ) {
89
88
this . _lengthRetrievers . push ( function ( next ) {
90
89
91
90
if ( value . hasOwnProperty ( 'fd' ) ) {
@@ -102,7 +101,7 @@ FormData.prototype._trackLength = function(header, value, options) {
102
101
// when end specified
103
102
// no need to calculate range
104
103
// inclusive, starts with 0
105
- next ( null , value . end + 1 - ( value . start ? value . start : 0 ) ) ;
104
+ next ( null , value . end + 1 - ( value . start ? value . start : 0 ) ) ;
106
105
107
106
// not that fast snoopy
108
107
} else {
@@ -230,14 +229,14 @@ FormData.prototype.getHeaders = function(userHeaders) {
230
229
} ;
231
230
232
231
FormData . prototype . getCustomHeaders = function ( contentType ) {
233
- contentType = contentType ? contentType : 'multipart/form-data' ;
232
+ contentType = contentType ? contentType : 'multipart/form-data' ;
234
233
235
- var formHeaders = {
236
- 'content-type' : contentType + '; boundary=' + this . getBoundary ( ) ,
237
- 'content-length' : this . getLengthSync ( )
238
- } ;
234
+ var formHeaders = {
235
+ 'content-type' : contentType + '; boundary=' + this . getBoundary ( ) ,
236
+ 'content-length' : this . getLengthSync ( )
237
+ } ;
239
238
240
- return formHeaders ;
239
+ return formHeaders ;
241
240
} ;
242
241
243
242
FormData . prototype . getBoundary = function ( ) {
@@ -318,16 +317,17 @@ FormData.prototype.submit = function(params, cb) {
318
317
// parse provided url if it's string
319
318
// or treat it as options object
320
319
if ( typeof params == 'string' ) {
321
- params = parseUrl ( params ) ;
322
320
321
+ params = parseUrl ( params ) ;
323
322
options = populate ( {
324
323
port : params . port ,
325
324
path : params . pathname ,
326
325
host : params . hostname
327
326
} , defaults ) ;
328
- }
329
- else // use custom params
330
- {
327
+
328
+ // use custom params
329
+ } else {
330
+
331
331
options = populate ( params , defaults ) ;
332
332
// if no port provided use default one
333
333
if ( ! options . port ) {
@@ -375,10 +375,6 @@ FormData.prototype._error = function(err) {
375
375
}
376
376
} ;
377
377
378
- /*
379
- * Santa's little helpers
380
- */
381
-
382
378
// populates missing values
383
379
function populate ( dst , src ) {
384
380
for ( var prop in src ) {
0 commit comments