From af3fe09510d4c6edf877878b3e9963d971475c4a Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 24 Dec 2021 00:17:18 +0200 Subject: [PATCH] added flag for better stack trace that by default is true --- lib/http.module.ts | 4 +++- lib/interfaces/http-module.interface.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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;