Browse Source

perf: 优化多文件上传入参是数组的情况 (#5757)

Co-authored-by: Jin Mao <50581550+jinmao88@users.noreply.github.com>
pull/5783/head
zhang 11 months ago
committed by GitHub
parent
commit
1616a06bfd
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      packages/effects/request/src/request-client/modules/uploader.ts

8
packages/effects/request/src/request-client/modules/uploader.ts

@ -16,7 +16,13 @@ class FileUploader {
const formData = new FormData();
Object.entries(data).forEach(([key, value]) => {
formData.append(key, value);
if (Array.isArray(value)) {
value.forEach((item, index) => {
formData.append(`${key}[${index}]`, item);
});
} else {
formData.append(key, value);
}
});
const finalConfig: RequestClientConfig = {

Loading…
Cancel
Save