@nodeflip/nest-axios-http
Version:
A NestJS module for simplified HTTP requests using Axios with dynamic configuration, logging, and interceptor support.
21 lines (20 loc) • 1.4 kB
TypeScript
import { AxiosRequestConfig, AxiosResponse } from "axios";
import { Logger } from "@nestjs/common";
import { IHttpModuleOptions } from "./types";
export declare class HttpService {
private axiosInstance;
logger: Logger;
constructor(options: IHttpModuleOptions);
private handleRequest;
private handleResponse;
private handleErrorResponse;
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig): Promise<R>;
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
}