@nodeflip/nest-axios-http
Version:
A NestJS module for simplified HTTP requests using Axios with dynamic configuration, logging, and interceptor support.
16 lines (15 loc) • 607 B
TypeScript
import { AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
import { Logger } from "@nestjs/common";
type AxiosInterceptorCallback<T> = (config: T) => T | Promise<T>;
export interface CustomAxiosRequestConfig extends AxiosRequestConfig {
enableLogging?: boolean;
onRequest?: AxiosInterceptorCallback<InternalAxiosRequestConfig>;
onResponse?: AxiosInterceptorCallback<AxiosResponse>;
onError?: AxiosInterceptorCallback<Error>;
}
export interface IHttpModuleOptions {
serviceName?: string;
logger?: Logger;
config: CustomAxiosRequestConfig;
}
export {};