@@ -14,7 +14,7 @@ const {
1414} = require ( './pool-base' )
1515const Pool = require ( './pool' )
1616const { kUrl } = require ( '../core/symbols' )
17- const { parseOrigin } = require ( '../core/util' )
17+ const util = require ( '../core/util' )
1818const kFactory = Symbol ( 'factory' )
1919
2020const kOptions = Symbol ( 'options' )
@@ -56,7 +56,10 @@ class BalancedPool extends PoolBase {
5656
5757 super ( )
5858
59- this [ kOptions ] = opts
59+ this [ kOptions ] = { ...util . deepClone ( opts ) }
60+ this [ kOptions ] . interceptors = opts . interceptors
61+ ? { ...opts . interceptors }
62+ : undefined
6063 this [ kIndex ] = - 1
6164 this [ kCurrentWeight ] = 0
6265
@@ -76,7 +79,7 @@ class BalancedPool extends PoolBase {
7679 }
7780
7881 addUpstream ( upstream ) {
79- const upstreamOrigin = parseOrigin ( upstream ) . origin
82+ const upstreamOrigin = util . parseOrigin ( upstream ) . origin
8083
8184 if ( this [ kClients ] . find ( ( pool ) => (
8285 pool [ kUrl ] . origin === upstreamOrigin &&
@@ -85,7 +88,7 @@ class BalancedPool extends PoolBase {
8588 ) ) ) {
8689 return this
8790 }
88- const pool = this [ kFactory ] ( upstreamOrigin , Object . assign ( { } , this [ kOptions ] ) )
91+ const pool = this [ kFactory ] ( upstreamOrigin , this [ kOptions ] )
8992
9093 this [ kAddClient ] ( pool )
9194 pool . on ( 'connect' , ( ) => {
@@ -125,7 +128,7 @@ class BalancedPool extends PoolBase {
125128 }
126129
127130 removeUpstream ( upstream ) {
128- const upstreamOrigin = parseOrigin ( upstream ) . origin
131+ const upstreamOrigin = util . parseOrigin ( upstream ) . origin
129132
130133 const pool = this [ kClients ] . find ( ( pool ) => (
131134 pool [ kUrl ] . origin === upstreamOrigin &&
@@ -141,7 +144,7 @@ class BalancedPool extends PoolBase {
141144 }
142145
143146 getUpstream ( upstream ) {
144- const upstreamOrigin = parseOrigin ( upstream ) . origin
147+ const upstreamOrigin = util . parseOrigin ( upstream ) . origin
145148
146149 return this [ kClients ] . find ( ( pool ) => (
147150 pool [ kUrl ] . origin === upstreamOrigin &&
0 commit comments