diff --git a/frontend/admin-web/src/infrastructure/http/http.client.ts b/frontend/admin-web/src/infrastructure/http/http.client.ts index efabfaf..009f92c 100644 --- a/frontend/admin-web/src/infrastructure/http/http.client.ts +++ b/frontend/admin-web/src/infrastructure/http/http.client.ts @@ -20,7 +20,7 @@ class HttpClient { headers: { 'Content-Type': 'application/json' }, }); - // Request 拦截器:注入 Bearer token + // Request 拦截器:注入 Bearer token;FormData 时删除 Content-Type 让浏览器自动带 boundary this.client.interceptors.request.use((config) => { if (typeof window !== 'undefined') { try { @@ -35,6 +35,9 @@ class HttpClient { // ignore parse errors } } + if (config.data instanceof FormData) { + delete config.headers['Content-Type']; + } return config; });