From c3d6997e0ffe6be2b4d388674bf12e94cf4a407e Mon Sep 17 00:00:00 2001 From: BTMuli Date: Sun, 4 Jan 2026 02:09:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20=E8=B0=83=E6=95=B4=E7=BD=91?= =?UTF-8?q?=E7=BB=9C=E8=AF=B7=E6=B1=82log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/TGHttp.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/utils/TGHttp.ts b/src/utils/TGHttp.ts index 3e8f0944..36a674f9 100644 --- a/src/utils/TGHttp.ts +++ b/src/utils/TGHttp.ts @@ -3,13 +3,13 @@ * @since Beta v0.9.1 */ -import { fetch } from "@tauri-apps/plugin-http"; +import { type ClientOptions, fetch } from "@tauri-apps/plugin-http"; import TGLogger from "./TGLogger.js"; /** * 请求参数 - * @since Beta v0.5.1 + * @since Beta v0.9.1 */ type TGHttpParams = { /** 请求方法 */ @@ -47,17 +47,20 @@ async function TGHttp( if (options.headers) { for (const key in options.headers) httpHeaders.append(key, options.headers[key]); } - const fetchOptions: RequestInit = { method: options.method, headers: httpHeaders }; + const fetchOptions: RequestInit & ClientOptions = { + method: options.method, + headers: httpHeaders, + }; if (options.body) fetchOptions.body = options.body; if (options.query) { const query = new URLSearchParams(options.query).toString(); url += `?${query}`; } if (options.isBlob) { - await TGLogger.Debug(`Fetch Image: ${url}`); + console.debug(`Fetch Blob: ${url}`); } else { - await TGLogger.Debug(`Fetch URL: ${url}`); - await TGLogger.Debug(`Fetch Options: ${JSON.stringify(options)}`); + console.debug(`Fetch URL: ${url}`); + console.debug(options); } return await fetch(url, fetchOptions) .then((res) => {