http.d.ts
758 Bytes
/// <reference types="node" />
import { AxiosResponse } from "axios";
import { Readable } from "stream";
declare type httpClientConfig = {
baseURL?: string;
defaultHeaders?: any;
responseParser?: <T>(res: AxiosResponse) => T;
};
export default class HTTPClient {
private instance;
private config;
constructor(config?: httpClientConfig);
get<T>(url: string, params?: any): Promise<T>;
getStream(url: string, params?: any): Promise<Readable>;
post<T>(url: string, body?: any): Promise<T>;
postForm<T>(url: string, body?: any): Promise<T>;
postBinary<T>(url: string, data: Buffer | Readable, contentType?: string): Promise<T>;
delete<T>(url: string, params?: any): Promise<T>;
private wrapError;
}
export {};