@tnhb/kits
Version:
TNHB Kits 请求工具 SDK By blak-kong
23 lines (22 loc) • 1.05 kB
TypeScript
/// <reference types="node" />
/**
* @author blak-kong
* @copyright blak-kong@foxmail.com
* @description 封装网络请求工具
*/
export declare class HttpKit {
private static delegate;
static get getHttpDelegate(): HttpDelegate;
static set setHttpDelegate(delegate: HttpDelegate);
}
export interface HttpDelegate {
httpGet(url: string, options?: any): Promise<any>;
httpGetToResponse(url: string, options?: any): Promise<any>;
httpPost(url: string, data: string, options?: any): Promise<any>;
httpPostToResponse(url: string, data: string, options?: any): Promise<any>;
httpDeleteToResponse(url: string, options?: any): Promise<any>;
httpPostWithCert(url: string, data: string, certFileContent: Buffer, passphrase: string): Promise<any>;
upload(url: string, filePath: string, params?: string): Promise<any>;
uploadToResponse(url: string, filePath: string, data: string, options?: any): Promise<any>;
httpPutToResponse(url: string, data: string, options?: any): Promise<any>;
}