Explorar o código

feat: FormData数据去请求头Content-Type

wanggaokun hai 1 ano
pai
achega
0b4d4aa2f0
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/api/index.ts

+ 4 - 0
src/api/index.ts

@@ -112,6 +112,10 @@ class RequestHttp {
           config.headers[encryptHeader] = encrypt(encryptBase64(aesKey))
           config.data = typeof config.data === 'object' ? encryptWithAes(JSON.stringify(config.data), aesKey) : encryptWithAes(config.data, aesKey)
         }
+        // FormData数据去请求头Content-Type
+        if (config.data instanceof FormData) {
+          delete config.headers['Content-Type']
+        }
         return config
       },
       (error: AxiosError) => {