diff --git a/lib/http.module.ts b/lib/http.module.ts index d847236..f85ecdb 100644 --- a/lib/http.module.ts +++ b/lib/http.module.ts @@ -18,7 +18,9 @@ import axiosBetterStacktrace from 'axios-better-stacktrace'; const createAxiosInstance = (config?: HttpModuleOptions) => { const axiosInstance = Axios.create(config); axiosRetry(axiosInstance, config); - axiosBetterStacktrace(axiosInstance); + if(config.isBetterStackTraceEnabled === undefined || config.isBetterStackTraceEnabled) { + axiosBetterStacktrace(axiosInstance); + } return axiosInstance; } diff --git a/lib/interfaces/http-module.interface.ts b/lib/interfaces/http-module.interface.ts index 1eee6f4..3875a3f 100644 --- a/lib/interfaces/http-module.interface.ts +++ b/lib/interfaces/http-module.interface.ts @@ -2,7 +2,7 @@ import { ModuleMetadata, Provider, Type } from '@nestjs/common'; import { AxiosRequestConfig } from 'axios'; import { IAxiosRetryConfig } from 'axios-retry' -export type HttpModuleOptions = (AxiosRequestConfig & IAxiosRetryConfig); +export type HttpModuleOptions = (AxiosRequestConfig & IAxiosRetryConfig & { isBetterStackTraceEnabled?: boolean }); export interface HttpModuleOptionsFactory { createHttpOptions(): Promise | HttpModuleOptions;