File tree 1 file changed +6
-3
lines changed
packages/requester-node-http/src
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,17 @@ export type NodeHttpRequesterOptions = {
12
12
httpsAgent ?: https . Agent ;
13
13
} ;
14
14
15
+ const agentOptions = { keepAlive : true } ;
16
+ const defaultHttpAgent = new http . Agent ( agentOptions ) ;
17
+ const defaultHttpsAgent = new https . Agent ( agentOptions ) ;
18
+
15
19
export function createNodeHttpRequester ( {
16
20
agent : userGlobalAgent ,
17
21
httpAgent : userHttpAgent ,
18
22
httpsAgent : userHttpsAgent ,
19
23
} : NodeHttpRequesterOptions = { } ) : Requester & Destroyable {
20
- const agentOptions = { keepAlive : true } ;
21
- const httpAgent = userHttpAgent || userGlobalAgent || new http . Agent ( agentOptions ) ;
22
- const httpsAgent = userHttpsAgent || userGlobalAgent || new https . Agent ( agentOptions ) ;
24
+ const httpAgent = userHttpAgent || userGlobalAgent || defaultHttpAgent ;
25
+ const httpsAgent = userHttpsAgent || userGlobalAgent || defaultHttpsAgent ;
23
26
24
27
return {
25
28
send ( request : Request ) : Readonly < Promise < Response > > {
You can’t perform that action at this time.
0 commit comments