http-dns-requester
Version:
A NodeJS wrapper to perform DNS resolution and HTTP/HTTPS requests with custom certificate authorities. Nice for container communication.
24 lines (23 loc) • 1.02 kB
TypeScript
export declare abstract class Requester {
protected host: string;
protected hostIP: string;
protected port: string;
protected proxyAgent: any;
protected isProxyInUse: boolean;
protected header: any;
constructor(host: string, port?: string);
get(path: string, body?: string): Promise<any>;
post(path: string, body?: string): Promise<any>;
put(path: string, body?: string): Promise<any>;
delete(path: string, body?: string): Promise<any>;
getJSON(path: string, body: any): Promise<any>;
postJSON(path: string, body: any): Promise<any>;
putJSON(path: string, body: any): Promise<any>;
deleteJSON(path: string, body: any): Promise<any>;
useProxy(proxyAgent: any): void;
performDnsResolve(): Promise<string>;
getHostIp(): string;
setHeader(header: any): void;
protected abstract request(path: string, method: string, body: string, json: boolean): Promise<any>;
protected HandleResponse(res: any, resolve: (resBody: any) => void): void;
}