Skip to content

Commit 3d1c8a8

Browse files
Merge pull request kailong321200875#456 from bigshans/patch-1
perf: 已经是 FormData 对象的不用再次转换
2 parents 898a507 + d582ad4 commit 3d1c8a8

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)