UNPKG

d-utils

Version:

d-utils

19 lines (18 loc) 681 B
export interface RequestInitWrapper extends RequestInit { timeOut?: number; showTip?: boolean; query?: object; } export declare type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; export declare type HttpContentType = 'application/json;charset=UTF-8' | 'application/x-www-form-urlencoded; charset=UTF-8'; export interface InterfaceType<T> { status: number; msg: string; result: T; } declare function http<T>(url: RequestInfo, c?: RequestInitWrapper): Promise<InterfaceType<T>>; interface StringObj { [props: string]: any; } export declare function formatRequestBody(params: StringObj): URLSearchParams; export default http;