import { AxiosRequestConfig, AxiosResponse } from "axios"; /** * HTTP 请求工具,基于 axios 封装。 * * @remarks * 提供 GET / POST 请求的统一封装,支持: * - 自动 JSON / querystring 解析 * - debug 模式日志输出 * - 统一的返回格式 `{ error, response, body, originbody }` * * 全局单例通过 `gHttpTool` 导出。 */ export declare class HttpTool { protected _debug: boolean; /** 是否开启 debug 模式,开启后输出请求日志 */ get debug(): boolean; set debug(value: boolean); /** * 发送 GET 请求。 * * @param config - axios 配置,额外支持 `form` 和 `qs` 字段 * * @returns 统一结构的响应:`{ error, response, body, originbody }` * - `error`: 错误信息,成功时为 null * - `response`: axios 原始响应 * - `body`: 解析后的响应体(JSON 对象或 querystring 对象) * - `originbody`: 原始响应体字符串 */ get(config: AxiosRequestConfig & { form?: any; }): Promise<{ error: any; response: AxiosResponse | null; body: any; originbody: any; }>; /** * 发送 POST 请求。 * * @param config - axios 配置,额外支持 `formData` 和 `form` 字段 * - `form`: 自动设置 Content-Type 为 `application/x-www-form-urlencoded` 并编码 * - `formData`: 原样作为请求体 * * @returns 统一结构的响应(同 `get()`) */ post(config: AxiosRequestConfig & { formData?: any; form?: any; }): Promise<{ error: any; response: AxiosResponse | null; body: any; originbody: any; }>; } /** HttpTool 全局单例 */ export declare let gHttpTool: HttpTool;