@@ -186,9 +186,11 @@ function ClientRequest(input, options, cb) {
186
186
const defaultPort = options . defaultPort ||
187
187
( this . agent && this . agent . defaultPort ) ;
188
188
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' ;
192
194
193
195
const setHost = ( options . setHost === undefined || Boolean ( options . setHost ) ) ;
194
196
@@ -200,6 +202,7 @@ function ClientRequest(input, options, cb) {
200
202
const signal = options . signal ;
201
203
if ( signal ) {
202
204
addAbortSignal ( signal , this ) ;
205
+ delete optsWithoutSignal . signal ;
203
206
}
204
207
let method = options . method ;
205
208
const methodIsString = ( typeof method === 'string' ) ;
@@ -326,12 +329,6 @@ function ClientRequest(input, options, cb) {
326
329
327
330
this [ kUniqueHeaders ] = parseUniqueHeadersOption ( options . uniqueHeaders ) ;
328
331
329
- let optsWithoutSignal = options ;
330
- if ( optsWithoutSignal . signal ) {
331
- optsWithoutSignal = ObjectAssign ( { } , options ) ;
332
- delete optsWithoutSignal . signal ;
333
- }
334
-
335
332
// initiate connection
336
333
if ( this . agent ) {
337
334
this . agent . addRequest ( this , optsWithoutSignal ) ;
0 commit comments