Skip to content

Commit 7c81d39

Browse files
committed
[fix] File Name parameter of Form Data utility
[optimize] update Upstream packages
1 parent 5cafcf2 commit 7c81d39

File tree

3 files changed

+51
-48
lines changed

3 files changed

+51
-48
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "koajax",
3-
"version": "0.9.5",
3+
"version": "0.9.6",
44
"license": "LGPL-3.0",
55
"author": "[email protected]",
66
"description": "HTTP Client based on Koa-like middlewares",
@@ -37,9 +37,9 @@
3737
"@parcel/packager-ts": "~2.10.3",
3838
"@parcel/transformer-typescript-types": "~2.10.3",
3939
"@types/core-js": "^2.5.8",
40-
"@types/jest": "^29.5.9",
40+
"@types/jest": "^29.5.10",
4141
"@types/jsdom": "^21.1.6",
42-
"@types/node": "^18.18.11",
42+
"@types/node": "^18.18.13",
4343
"core-js": "^3.33.3",
4444
"cross-env": "^7.0.3",
4545
"husky": "^8.0.3",

pnpm-lock.yaml

+40-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/utility.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ export function makeFormData(data: Record<string, any>) {
1818
typeof value !== 'string' && likeArray(value) ? value : [value]
1919
) as ArrayLike<string | Blob>;
2020

21-
Array.from(list, item => item != null && formData.append(key, item));
21+
for (const item of Array.from(list))
22+
if (item != null)
23+
if (typeof item === 'object')
24+
formData.append(key, item, (item as File).name);
25+
else formData.append(key, item);
2226
}
23-
2427
return formData;
2528
}
2629

@@ -33,9 +36,9 @@ export function serializeNode(root: Node) {
3336
root instanceof SVGElement
3437
? 'image/svg'
3538
: root instanceof HTMLDocument ||
36-
root instanceof HTMLElement
37-
? 'text/html'
38-
: 'application/xml',
39+
root instanceof HTMLElement
40+
? 'text/html'
41+
: 'application/xml',
3942
data: stringifyDOM(root)
4043
};
4144

0 commit comments

Comments
 (0)