undici 7.24.0 → 7.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@ const {
|
|
|
14
14
|
} = require('./pool-base')
|
|
15
15
|
const Pool = require('./pool')
|
|
16
16
|
const { kUrl } = require('../core/symbols')
|
|
17
|
-
const
|
|
17
|
+
const util = require('../core/util')
|
|
18
18
|
const kFactory = Symbol('factory')
|
|
19
19
|
|
|
20
20
|
const kOptions = Symbol('options')
|
|
@@ -56,7 +56,10 @@ class BalancedPool extends PoolBase {
|
|
|
56
56
|
|
|
57
57
|
super()
|
|
58
58
|
|
|
59
|
-
this[kOptions] = opts
|
|
59
|
+
this[kOptions] = { ...util.deepClone(opts) }
|
|
60
|
+
this[kOptions].interceptors = opts.interceptors
|
|
61
|
+
? { ...opts.interceptors }
|
|
62
|
+
: undefined
|
|
60
63
|
this[kIndex] = -1
|
|
61
64
|
this[kCurrentWeight] = 0
|
|
62
65
|
|
|
@@ -76,7 +79,7 @@ class BalancedPool extends PoolBase {
|
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
addUpstream (upstream) {
|
|
79
|
-
const upstreamOrigin = parseOrigin(upstream).origin
|
|
82
|
+
const upstreamOrigin = util.parseOrigin(upstream).origin
|
|
80
83
|
|
|
81
84
|
if (this[kClients].find((pool) => (
|
|
82
85
|
pool[kUrl].origin === upstreamOrigin &&
|
|
@@ -85,7 +88,7 @@ class BalancedPool extends PoolBase {
|
|
|
85
88
|
))) {
|
|
86
89
|
return this
|
|
87
90
|
}
|
|
88
|
-
const pool = this[kFactory](upstreamOrigin,
|
|
91
|
+
const pool = this[kFactory](upstreamOrigin, this[kOptions])
|
|
89
92
|
|
|
90
93
|
this[kAddClient](pool)
|
|
91
94
|
pool.on('connect', () => {
|
|
@@ -125,7 +128,7 @@ class BalancedPool extends PoolBase {
|
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
removeUpstream (upstream) {
|
|
128
|
-
const upstreamOrigin = parseOrigin(upstream).origin
|
|
131
|
+
const upstreamOrigin = util.parseOrigin(upstream).origin
|
|
129
132
|
|
|
130
133
|
const pool = this[kClients].find((pool) => (
|
|
131
134
|
pool[kUrl].origin === upstreamOrigin &&
|
|
@@ -141,7 +144,7 @@ class BalancedPool extends PoolBase {
|
|
|
141
144
|
}
|
|
142
145
|
|
|
143
146
|
getUpstream (upstream) {
|
|
144
|
-
const upstreamOrigin = parseOrigin(upstream).origin
|
|
147
|
+
const upstreamOrigin = util.parseOrigin(upstream).origin
|
|
145
148
|
|
|
146
149
|
return this[kClients].find((pool) => (
|
|
147
150
|
pool[kUrl].origin === upstreamOrigin &&
|