@pedro2s/nestjs-http-async
Version:
HttpService Async for NestJS
21 lines (20 loc) • 1.13 kB
TypeScript
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from "axios";
export interface CustomAxiosRequestConfig extends CreateAxiosDefaults {
enableLogging?: boolean;
}
export declare class HttpAsyncService {
private readonly config;
readonly axiosInstance: AxiosInstance;
constructor(config: CustomAxiosRequestConfig);
private handleRequest;
private handleResponse;
private handleErrorResponse;
request<T>(config: AxiosRequestConfig): Promise<AxiosResponse<T>>;
get<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
post<T>(url: string, data: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
put<T>(url: string, data: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
patch<T>(url: string, data: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
delete<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
head<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
options<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
}