added flag for better stack trace that by default is true
This commit is contained in:
parent
f3e8f4186e
commit
af3fe09510
2 changed files with 4 additions and 2 deletions
|
@ -18,7 +18,9 @@ import axiosBetterStacktrace from 'axios-better-stacktrace';
|
||||||
const createAxiosInstance = (config?: HttpModuleOptions) => {
|
const createAxiosInstance = (config?: HttpModuleOptions) => {
|
||||||
const axiosInstance = Axios.create(config);
|
const axiosInstance = Axios.create(config);
|
||||||
axiosRetry(axiosInstance, config);
|
axiosRetry(axiosInstance, config);
|
||||||
|
if(config.isBetterStackTraceEnabled === undefined || config.isBetterStackTraceEnabled) {
|
||||||
axiosBetterStacktrace(axiosInstance);
|
axiosBetterStacktrace(axiosInstance);
|
||||||
|
}
|
||||||
return axiosInstance;
|
return axiosInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ModuleMetadata, Provider, Type } from '@nestjs/common';
|
||||||
import { AxiosRequestConfig } from 'axios';
|
import { AxiosRequestConfig } from 'axios';
|
||||||
import { IAxiosRetryConfig } from 'axios-retry'
|
import { IAxiosRetryConfig } from 'axios-retry'
|
||||||
|
|
||||||
export type HttpModuleOptions = (AxiosRequestConfig & IAxiosRetryConfig);
|
export type HttpModuleOptions = (AxiosRequestConfig & IAxiosRetryConfig & { isBetterStackTraceEnabled?: boolean });
|
||||||
|
|
||||||
export interface HttpModuleOptionsFactory {
|
export interface HttpModuleOptionsFactory {
|
||||||
createHttpOptions(): Promise<HttpModuleOptions> | HttpModuleOptions;
|
createHttpOptions(): Promise<HttpModuleOptions> | HttpModuleOptions;
|
||||||
|
|
Loading…
Reference in a new issue