@@ -103,7 +103,7 @@ FormData.prototype._trackLength = function(header, value, options) {
103
103
FormData . LINE_BREAK . length ;
104
104
105
105
// empty or either doesn't have path or not an http response or not a stream
106
- if ( ! value || ( ! value . path && ! ( value . readable && value . hasOwnProperty ( 'httpVersion' ) ) && ! ( value instanceof Stream ) ) ) {
106
+ if ( ! value || ( ! value . path && ! ( value . readable && Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) && ! ( value instanceof Stream ) ) ) {
107
107
return ;
108
108
}
109
109
@@ -114,8 +114,7 @@ FormData.prototype._trackLength = function(header, value, options) {
114
114
} ;
115
115
116
116
FormData . prototype . _lengthRetriever = function ( value , callback ) {
117
-
118
- if ( value . hasOwnProperty ( 'fd' ) ) {
117
+ if ( Object . prototype . hasOwnProperty . call ( value , 'fd' ) ) {
119
118
120
119
// take read range into a account
121
120
// `end` = Infinity –> read file till the end
@@ -150,11 +149,11 @@ FormData.prototype._lengthRetriever = function(value, callback) {
150
149
}
151
150
152
151
// or http response
153
- } else if ( value . hasOwnProperty ( 'httpVersion' ) ) {
152
+ } else if ( Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) {
154
153
callback ( null , + value . headers [ 'content-length' ] ) ;
155
154
156
155
// or request stream http://github.com/mikeal/request
157
- } else if ( value . hasOwnProperty ( 'httpModule' ) ) {
156
+ } else if ( Object . prototype . hasOwnProperty . call ( value , 'httpModule' ) ) {
158
157
// wait till response come back
159
158
value . on ( 'response' , function ( response ) {
160
159
value . pause ( ) ;
@@ -194,22 +193,23 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
194
193
195
194
var header ;
196
195
for ( var prop in headers ) {
197
- if ( ! headers . hasOwnProperty ( prop ) ) continue ;
198
- header = headers [ prop ] ;
196
+ if ( Object . prototype . hasOwnProperty . call ( headers , prop ) ) {
197
+ header = headers [ prop ] ;
199
198
200
- // skip nullish headers.
201
- if ( header == null ) {
202
- continue ;
203
- }
199
+ // skip nullish headers.
200
+ if ( header == null ) {
201
+ continue ;
202
+ }
204
203
205
- // convert all headers to arrays.
206
- if ( ! Array . isArray ( header ) ) {
207
- header = [ header ] ;
208
- }
204
+ // convert all headers to arrays.
205
+ if ( ! Array . isArray ( header ) ) {
206
+ header = [ header ] ;
207
+ }
209
208
210
- // add non-empty headers.
211
- if ( header . length ) {
212
- contents += prop + ': ' + header . join ( '; ' ) + FormData . LINE_BREAK ;
209
+ // add non-empty headers.
210
+ if ( header . length ) {
211
+ contents += prop + ': ' + header . join ( '; ' ) + FormData . LINE_BREAK ;
212
+ }
213
213
}
214
214
}
215
215
@@ -230,7 +230,7 @@ FormData.prototype._getContentDisposition = function(value, options) {
230
230
// formidable and the browser add a name property
231
231
// fs- and request- streams have path property
232
232
filename = path . basename ( options . filename || value . name || value . path ) ;
233
- } else if ( value . readable && value . hasOwnProperty ( 'httpVersion' ) ) {
233
+ } else if ( value . readable && Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) {
234
234
// or try http response
235
235
filename = path . basename ( value . client . _httpMessage . path || '' ) ;
236
236
}
@@ -258,7 +258,7 @@ FormData.prototype._getContentType = function(value, options) {
258
258
}
259
259
260
260
// or if it's http-reponse
261
- if ( ! contentType && value . readable && value . hasOwnProperty ( 'httpVersion' ) ) {
261
+ if ( ! contentType && value . readable && Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) {
262
262
contentType = value . headers [ 'content-type' ] ;
263
263
}
264
264
@@ -299,7 +299,7 @@ FormData.prototype.getHeaders = function(userHeaders) {
299
299
} ;
300
300
301
301
for ( header in userHeaders ) {
302
- if ( userHeaders . hasOwnProperty ( header ) ) {
302
+ if ( Object . prototype . hasOwnProperty . call ( userHeaders , header ) ) {
303
303
formHeaders [ header . toLowerCase ( ) ] = userHeaders [ header ] ;
304
304
}
305
305
}
0 commit comments