From 60e194afc9b289190fb02fd9637f4b06deaf1dcb Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Mon, 15 Sep 2025 10:25:47 +0800 Subject: [PATCH] =?UTF-8?q?chore(http):=20=E6=8B=A6=E6=88=AA=E5=99=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0Content-Type=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/interceptor.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/http/interceptor.ts b/src/http/interceptor.ts index 377302f..5906e39 100644 --- a/src/http/interceptor.ts +++ b/src/http/interceptor.ts @@ -43,8 +43,9 @@ const httpInterceptor = { options.timeout = 60000 // 60s // 2. (可选)添加小程序端请求头标识 options.header = { - platform, // 可选,与 uniapp 定义的平台一致,告诉后台来源 ...options.header, + 'Content-Type': 'application/json; charset=utf-8', + platform, // 可选,与 uniapp 定义的平台一致,告诉后台来源 } // 3. 添加 token 请求头标识 const tokenStore = useTokenStore() @@ -53,6 +54,7 @@ const httpInterceptor = { if (token) { options.header.Authorization = `Bearer ${token}` } + return options }, }