@@ -101,7 +101,7 @@ FormData.prototype._trackLength = function(header, value, options) {
101101 FormData . LINE_BREAK . length ;
102102
103103 // empty or either doesn't have path or not an http response
104- if ( ! value || ( ! value . path && ! ( value . readable && value . hasOwnProperty ( 'httpVersion' ) ) ) ) {
104+ if ( ! value || ( ! value . path && ! ( value . readable && Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) ) ) {
105105 return ;
106106 }
107107
@@ -112,8 +112,7 @@ FormData.prototype._trackLength = function(header, value, options) {
112112} ;
113113
114114FormData . prototype . _lengthRetriever = function ( value , callback ) {
115-
116- if ( value . hasOwnProperty ( 'fd' ) ) {
115+ if ( Object . prototype . hasOwnProperty . call ( value , 'fd' ) ) {
117116
118117 // take read range into a account
119118 // `end` = Infinity –> read file till the end
@@ -148,11 +147,11 @@ FormData.prototype._lengthRetriever = function(value, callback) {
148147 }
149148
150149 // or http response
151- } else if ( value . hasOwnProperty ( 'httpVersion' ) ) {
150+ } else if ( Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) {
152151 callback ( null , + value . headers [ 'content-length' ] ) ;
153152
154153 // or request stream http://github.com/mikeal/request
155- } else if ( value . hasOwnProperty ( 'httpModule' ) ) {
154+ } else if ( Object . prototype . hasOwnProperty . call ( value , 'httpModule' ) ) {
156155 // wait till response come back
157156 value . on ( 'response' , function ( response ) {
158157 value . pause ( ) ;
@@ -192,22 +191,23 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
192191
193192 var header ;
194193 for ( var prop in headers ) {
195- if ( ! headers . hasOwnProperty ( prop ) ) continue ;
196- header = headers [ prop ] ;
194+ if ( Object . prototype . hasOwnProperty . call ( headers , prop ) ) {
195+ header = headers [ prop ] ;
197196
198- // skip nullish headers.
199- if ( header == null ) {
200- continue ;
201- }
197+ // skip nullish headers.
198+ if ( header == null ) {
199+ continue ;
200+ }
202201
203- // convert all headers to arrays.
204- if ( ! Array . isArray ( header ) ) {
205- header = [ header ] ;
206- }
202+ // convert all headers to arrays.
203+ if ( ! Array . isArray ( header ) ) {
204+ header = [ header ] ;
205+ }
207206
208- // add non-empty headers.
209- if ( header . length ) {
210- contents += prop + ': ' + header . join ( '; ' ) + FormData . LINE_BREAK ;
207+ // add non-empty headers.
208+ if ( header . length ) {
209+ contents += prop + ': ' + header . join ( '; ' ) + FormData . LINE_BREAK ;
210+ }
211211 }
212212 }
213213
@@ -228,7 +228,7 @@ FormData.prototype._getContentDisposition = function(value, options) {
228228 // formidable and the browser add a name property
229229 // fs- and request- streams have path property
230230 filename = path . basename ( options . filename || value . name || value . path ) ;
231- } else if ( value . readable && value . hasOwnProperty ( 'httpVersion' ) ) {
231+ } else if ( value . readable && Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) {
232232 // or try http response
233233 filename = path . basename ( value . client . _httpMessage . path || '' ) ;
234234 }
@@ -256,7 +256,7 @@ FormData.prototype._getContentType = function(value, options) {
256256 }
257257
258258 // or if it's http-reponse
259- if ( ! contentType && value . readable && value . hasOwnProperty ( 'httpVersion' ) ) {
259+ if ( ! contentType && value . readable && Object . prototype . hasOwnProperty . call ( value , 'httpVersion' ) ) {
260260 contentType = value . headers [ 'content-type' ] ;
261261 }
262262
@@ -297,7 +297,7 @@ FormData.prototype.getHeaders = function(userHeaders) {
297297 } ;
298298
299299 for ( header in userHeaders ) {
300- if ( userHeaders . hasOwnProperty ( header ) ) {
300+ if ( Object . prototype . hasOwnProperty . call ( userHeaders , header ) ) {
301301 formHeaders [ header . toLowerCase ( ) ] = userHeaders [ header ] ;
302302 }
303303 }
0 commit comments