File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/requester-node-http/src Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,17 @@ export type NodeHttpRequesterOptions = {
1212 httpsAgent ?: https . Agent ;
1313} ;
1414
15+ const agentOptions = { keepAlive : true } ;
16+ const defaultHttpAgent = new http . Agent ( agentOptions ) ;
17+ const defaultHttpsAgent = new https . Agent ( agentOptions ) ;
18+
1519export function createNodeHttpRequester ( {
1620 agent : userGlobalAgent ,
1721 httpAgent : userHttpAgent ,
1822 httpsAgent : userHttpsAgent ,
1923} : 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 ;
2326
2427 return {
2528 send ( request : Request ) : Readonly < Promise < Response > > {
You can’t perform that action at this time.
0 commit comments