Skip to content

Commit c716c9d

Browse files
authored
Merge pull request #438 from g-ongenae/fixture/fix-agent-used
[FIX] Fix HTTPS agent
2 parents e1572d5 + 1849fea commit c716c9d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/aggregator/services/bridge/bridge.client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Agent } from 'node:http';
1+
import { Agent as HttpAgent } from 'node:http';
2+
import { Agent as HttpsAgent } from 'node:https';
23
import { HttpService } from '@nestjs/axios';
34
import { CACHE_MANAGER, Inject, Injectable, Logger } from '@nestjs/common';
45
import { AxiosError, AxiosRequestConfig, AxiosRequestHeaders, AxiosResponse, AxiosResponseHeaders } from 'axios';
@@ -46,10 +47,8 @@ export class BridgeClient {
4647
private readonly logger: Logger = new Logger(BridgeClient.name);
4748

4849
constructor(@Inject(CACHE_MANAGER) private readonly cacheManager: Cache, private readonly httpService: HttpService) {
49-
const httpAgent = new Agent({ keepAlive: true });
50-
51-
this.httpService.axiosRef.defaults.httpAgent = httpAgent;
52-
this.httpService.axiosRef.defaults.httpsAgent = httpAgent;
50+
this.httpService.axiosRef.defaults.httpAgent = new HttpAgent({ keepAlive: true });
51+
this.httpService.axiosRef.defaults.httpsAgent = new HttpsAgent({ keepAlive: true });
5352

5453
axiosRetry(this.httpService.axiosRef, {
5554
retries: 3,

0 commit comments

Comments
 (0)