From 657b017c84023c1f30d35063cdfea3ed70a74a5c Mon Sep 17 00:00:00 2001 From: gandara- Date: Thu, 26 Sep 2024 09:18:59 -0300 Subject: [PATCH] feat: add httpsAgent to axios client --- src/auth.ts | 3 ++- src/axios.ts | 3 ++- src/types.ts | 4 ++++ tsconfig.json | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/auth.ts b/src/auth.ts index f68d64a..3d9b410 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -62,7 +62,8 @@ export class BearerAuth extends BaseBearerAuth implements AuthBasic { super(authOptions); this.authOptions = authOptions; this.client = axios.create({ - baseURL: this.authOptions.baseUrl + baseURL: this.authOptions.baseUrl, + httpsAgent: this.authOptions.httpsAgent }); } diff --git a/src/axios.ts b/src/axios.ts index e6f9294..4ab6892 100644 --- a/src/axios.ts +++ b/src/axios.ts @@ -14,7 +14,8 @@ export class AxiosClient extends BaseClient implements AxiosClientInterface { this.clientOptions = clientOptions; this.client = axios.create({ - baseURL: clientOptions.baseURL + baseURL: clientOptions.baseURL, + httpsAgent: clientOptions.httpsAgent }); } diff --git a/src/types.ts b/src/types.ts index 27dc2fd..de7234e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,5 @@ +import https from 'https'; + /** * ClientOptions type * @description Type for ClientOptions @@ -46,6 +48,7 @@ export type ClientOptionsZendesk = ClientOptions & { export type ClientOptionsAxios = ClientOptions & { baseURL: string; + httpsAgent?: https.Agent; }; /** @@ -135,6 +138,7 @@ export type AuthOptions = { password?: string; bearer?: BearerAuthOptions; bearerTokenProperty?: string; + httpsAgent?: https.Agent; }; /** diff --git a/tsconfig.json b/tsconfig.json index 10ec881..c5667de 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "moduleResolution": "node", "allowJs": false, "noUnusedLocals": true, - "declaration": true + "declaration": true, + "esModuleInterop": true }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]