@@ -186,9 +186,11 @@ function ClientRequest(input, options, cb) {
186186 const defaultPort = options . defaultPort ||
187187 ( this . agent && this . agent . defaultPort ) ;
188188
189- const port = options . port = options . port || defaultPort || 80 ;
190- const host = options . host = validateHost ( options . hostname , 'hostname' ) ||
191- validateHost ( options . host , 'host' ) || 'localhost' ;
189+ const optsWithoutSignal = { __proto__ : null , ...options } ;
190+
191+ const port = optsWithoutSignal . port = options . port || defaultPort || 80 ;
192+ const host = optsWithoutSignal . host = validateHost ( options . hostname , 'hostname' ) ||
193+ validateHost ( options . host , 'host' ) || 'localhost' ;
192194
193195 const setHost = ( options . setHost === undefined || Boolean ( options . setHost ) ) ;
194196
@@ -200,6 +202,7 @@ function ClientRequest(input, options, cb) {
200202 const signal = options . signal ;
201203 if ( signal ) {
202204 addAbortSignal ( signal , this ) ;
205+ delete optsWithoutSignal . signal ;
203206 }
204207 let method = options . method ;
205208 const methodIsString = ( typeof method === 'string' ) ;
@@ -326,12 +329,6 @@ function ClientRequest(input, options, cb) {
326329
327330 this [ kUniqueHeaders ] = parseUniqueHeadersOption ( options . uniqueHeaders ) ;
328331
329- let optsWithoutSignal = options ;
330- if ( optsWithoutSignal . signal ) {
331- optsWithoutSignal = ObjectAssign ( { } , options ) ;
332- delete optsWithoutSignal . signal ;
333- }
334-
335332 // initiate connection
336333 if ( this . agent ) {
337334 this . agent . addRequest ( this , optsWithoutSignal ) ;
0 commit comments