@@ -103,7 +103,7 @@ FormData.prototype._trackLength = function(header, value, options) {
103103 FormData . LINE_BREAK . length ;
104104
105105 // empty or either doesn't have path or not an http response
106- if ( ! value || ( ! value . path && ! ( value . readable && value . hasOwnProperty ( 'httpVersion' ) ) ) ) {
106+ if ( ! value || ( ! value . path && ! ( value . readable && Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) ) ) {
107107 return ;
108108 }
109109
@@ -114,8 +114,7 @@ FormData.prototype._trackLength = function(header, value, options) {
114114} ;
115115
116116FormData . prototype . _lengthRetriever = function ( value , callback ) {
117-
118- if ( value . hasOwnProperty ( 'fd' ) ) {
117+ if ( Object . prototype . hasOwnProperty . call ( value , 'fd' ) ) {
119118
120119 // take read range into a account
121120 // `end` = Infinity –> read file till the end
@@ -150,11 +149,11 @@ FormData.prototype._lengthRetriever = function(value, callback) {
150149 }
151150
152151 // or http response
153- } else if ( value . hasOwnProperty ( 'httpVersion' ) ) {
152+ } else if ( Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) {
154153 callback ( null , + value . headers [ 'content-length' ] ) ;
155154
156155 // or request stream http://github.com/mikeal/request
157- } else if ( value . hasOwnProperty ( 'httpModule' ) ) {
156+ } else if ( Object . prototype . hasOwnProperty . call ( value , 'httpModule' ) ) {
158157 // wait till response come back
159158 value . on ( 'response' , function ( response ) {
160159 value . pause ( ) ;
@@ -194,22 +193,23 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
194193
195194 var header ;
196195 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 ] ;
199198
200- // skip nullish headers.
201- if ( header == null ) {
202- continue ;
203- }
199+ // skip nullish headers.
200+ if ( header == null ) {
201+ continue ;
202+ }
204203
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+ }
209208
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+ }
213213 }
214214 }
215215
@@ -230,7 +230,7 @@ FormData.prototype._getContentDisposition = function(value, options) {
230230 // formidable and the browser add a name property
231231 // fs- and request- streams have path property
232232 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' ) ) {
234234 // or try http response
235235 filename = path . basename ( value . client . _httpMessage . path || '' ) ;
236236 }
@@ -258,7 +258,7 @@ FormData.prototype._getContentType = function(value, options) {
258258 }
259259
260260 // 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' ) ) {
262262 contentType = value . headers [ 'content-type' ] ;
263263 }
264264
@@ -299,7 +299,7 @@ FormData.prototype.getHeaders = function(userHeaders) {
299299 } ;
300300
301301 for ( header in userHeaders ) {
302- if ( userHeaders . hasOwnProperty ( header ) ) {
302+ if ( Object . prototype . hasOwnProperty . call ( userHeaders , header ) ) {
303303 formHeaders [ header . toLowerCase ( ) ] = userHeaders [ header ] ;
304304 }
305305 }
0 commit comments