diff --git a/lib/dispatcher/h2c-client.js b/lib/dispatcher/h2c-client.js index a551f5d5b33..3885d85985b 100644 --- a/lib/dispatcher/h2c-client.js +++ b/lib/dispatcher/h2c-client.js @@ -12,8 +12,6 @@ class H2CClient extends DispatcherBase { #client = null constructor (origin, clientOpts) { - super() - if (typeof origin === 'string') { origin = new URL(origin) } @@ -47,6 +45,8 @@ class H2CClient extends DispatcherBase { ) } + super() + this.#client = new Client(origin, { ...opts, connect: this.#buildConnector(connect), diff --git a/lib/dispatcher/pool.js b/lib/dispatcher/pool.js index 00cf50c3012..77fd5326696 100644 --- a/lib/dispatcher/pool.js +++ b/lib/dispatcher/pool.js @@ -51,8 +51,6 @@ class Pool extends PoolBase { throw new InvalidArgumentError('connect must be a function or an object') } - super() - if (typeof connect !== 'function') { connect = buildConnector({ ...tls, @@ -65,6 +63,8 @@ class Pool extends PoolBase { }) } + super() + this[kConnections] = connections || null this[kUrl] = util.parseOrigin(origin) this[kOptions] = { ...util.deepClone(options), connect, allowH2, clientTtl } diff --git a/lib/dispatcher/proxy-agent.js b/lib/dispatcher/proxy-agent.js index 39f8266d24b..c67dc810985 100644 --- a/lib/dispatcher/proxy-agent.js +++ b/lib/dispatcher/proxy-agent.js @@ -37,11 +37,12 @@ class Http1ProxyWrapper extends DispatcherBase { #client constructor (proxyUrl, { headers = {}, connect, factory }) { - super() if (!proxyUrl) { throw new InvalidArgumentError('Proxy URL is mandatory') } + super() + this[kProxyHeaders] = headers if (factory) { this.#client = factory(proxyUrl, { connect })