Skip to content

Commit d582ad4

Browse files
authored
perf: 已经是 FormData 对象的不用再次转换
在特定条件下,FormData 转 FormData 会存在问题。
1 parent 898a507 commit d582ad4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/axios/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const defaultRequestInterceptors = (config: InternalAxiosRequestConfig) => {
1414
} else if (
1515
TRANSFORM_REQUEST_DATA &&
1616
config.method === 'post' &&
17-
config.headers['Content-Type'] === 'multipart/form-data'
17+
config.headers['Content-Type'] === 'multipart/form-data' &&
18+
!(config.data instanceof FormData)
1819
) {
1920
config.data = objToFormData(config.data)
2021
}

0 commit comments

Comments
 (0)