added flag for better stack trace that by default is true

This commit is contained in:
ben 2021-12-24 00:17:18 +02:00
parent f3e8f4186e
commit af3fe09510
2 changed files with 4 additions and 2 deletions

View file

@ -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;
}

View file

@ -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> | HttpModuleOptions;