Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions templates/base/http-clients/fetch-http-client.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,16 @@ 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) {
formData.append(
key,
formItem instanceof Blob || typeof formItem === "string"
? formItem
: JSON.stringify(formItem)
);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: FormData Serialization Fails with BigInt and Undefined

The FormData serialization logic now uses JSON.stringify for non-Blob/non-string values, which introduces two issues. BigInt values now cause a TypeError. Also, undefined values are passed as the undefined primitive to formData.append(), relying on implicit browser conversion instead of the previous explicit string conversion, which may lead to unexpected behavior.

Fix in Cursor Fix in Web

return formData;
}, new FormData());
},
Expand Down
Loading
Loading