Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/dispatcher/balanced-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class BalancedPool extends PoolBase {
throw new InvalidArgumentError('factory must be a function.')
}

super()
super(opts)

this[kOptions] = { ...util.deepClone(opts) }
this[kIndex] = -1
Expand Down
2 changes: 1 addition & 1 deletion lib/dispatcher/env-http-proxy-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EnvHttpProxyAgent extends DispatcherBase {
#opts = null

constructor (opts = {}) {
super()
super(opts)
this.#opts = opts

const { httpProxy, httpsProxy, noProxy, ...agentOpts } = opts
Expand Down
2 changes: 1 addition & 1 deletion lib/dispatcher/proxy-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class ProxyAgent extends DispatcherBase {

const { proxyTunnel, connectTimeout } = opts

super()
super(opts)

const url = this.#getUrl(opts)
const { href, origin, port, protocol, username, password, hostname: proxyHostname } = url
Expand Down
2 changes: 1 addition & 1 deletion lib/dispatcher/round-robin-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class RoundRobinPool extends PoolBase {
})
}

super()
super(options)

this[kConnections] = connections || null
this[kUrl] = util.parseOrigin(origin)
Expand Down
2 changes: 1 addition & 1 deletion lib/dispatcher/socks5-proxy-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let experimentalWarningEmitted = false
*/
class Socks5ProxyAgent extends DispatcherBase {
constructor (proxyUrl, options = {}) {
super()
super(options)

// Emit experimental warning only once
if (!experimentalWarningEmitted) {
Expand Down
41 changes: 41 additions & 0 deletions test/websocket/dispatcher-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict'

const { test } = require('node:test')
const {
BalancedPool,
EnvHttpProxyAgent,
ProxyAgent,
RoundRobinPool,
Socks5ProxyAgent
} = require('../..')

const webSocket = {
maxFragments: 8,
maxPayloadSize: 1024
}

const dispatchers = {
BalancedPool: () => new BalancedPool([], { webSocket }),
EnvHttpProxyAgent: () => new EnvHttpProxyAgent({
httpProxy: '',
httpsProxy: '',
noProxy: '*',
webSocket
}),
ProxyAgent: () => new ProxyAgent({
uri: 'http://localhost',
webSocket
}),
RoundRobinPool: () => new RoundRobinPool('http://localhost', { webSocket }),
Socks5ProxyAgent: () => new Socks5ProxyAgent('socks5://localhost', { webSocket })
}

for (const [name, createDispatcher] of Object.entries(dispatchers)) {
test(`${name} applies WebSocket options`, async (t) => {
const dispatcher = createDispatcher()

t.after(() => dispatcher.close())

t.assert.deepStrictEqual(dispatcher.webSocketOptions, webSocket)
})
}
Loading