UNPKG

@farris/devkit-vue

Version:
59 lines (58 loc) 1.25 kB
/** * 请求头信息 */ interface HttpHeaders { [key: string]: string; } /** * Http参数 */ interface HttpParams { [key: string]: string; } /** * 请求方法 */ type HttpMethod = 'GET' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH' | 'LINK' | 'UNLINK'; /** * HttpMethods */ declare class HttpMethods { static GET: HttpMethod; static DELETE: HttpMethod; static HEAD: HttpMethod; static OPTIONS: HttpMethod; static POST: HttpMethod; static PUT: HttpMethod; static PATCH: HttpMethod; static LINK: HttpMethod; static UNLINK: HttpMethod; } /** * 返回值类型 */ type HttpResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'; /** * 返回值处理类型 */ type ObserveType = 'body' | 'response'; /** * Http响应信息 */ interface HttpResponse { headers: any; body: any; status: number; statusText: string; } /** * Http请求配置 */ interface HttpRequestConfig { params?: HttpParams; body?: any; headers?: HttpHeaders; responseType?: HttpResponseType; observe?: 'body' | 'response'; } export { HttpHeaders, HttpParams, HttpMethod, HttpMethods, ObserveType, HttpResponseType, HttpRequestConfig, HttpResponse };