-
-
Notifications
You must be signed in to change notification settings - Fork 420
fix: handle arrays properly in FormData #1431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
c1b22ef
e4c4bae
b9da1cd
6e854b8
abc99ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,14 +113,12 @@ export class HttpClient<SecurityDataType = unknown> { | |
|
|
||
| return Object.keys(input || {}).reduce((formData, key) => { | ||
| const property = input[key]; | ||
| formData.append( | ||
| key, | ||
| property instanceof Blob ? | ||
| property : | ||
| typeof property === "object" && property !== null ? | ||
| JSON.stringify(property) : | ||
| `${property}` | ||
| ); | ||
| const propertyContent = property instanceof Array ? property : [property]; | ||
|
|
||
| for (const formItem of propertyContent) { | ||
| const isFileType = formItem instanceof Blob || formItem instanceof File; | ||
| formData.append(key, isFileType ? formItem : JSON.stringify(formItem)); | ||
omarmciver marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: FormData Serialization Fails with BigInt and UndefinedThe |
||
| return formData; | ||
| }, new FormData()); | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.