Skip to content

Commit 136985c

Browse files
committed
fix(functions): preserve caller-supplied FormData contents
1 parent 4ebcc76 commit 136985c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎src/modules/functions.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ export function createFunctionsModule(
5656
let contentType: string;
5757

5858
// Handle file uploads with FormData
59-
if (
60-
data instanceof FormData ||
61-
(data && Object.values(data).some((value) => value instanceof File))
62-
) {
59+
if (data instanceof FormData) {
60+
// Preserve fields, repeated keys, and files already encoded by callers.
61+
formData = data;
62+
contentType = "multipart/form-data";
63+
} else if (data && Object.values(data).some((value) => value instanceof File)) {
6364
formData = new FormData();
6465
Object.keys(data).forEach((key) => {
6566
if (data[key] instanceof File) {

0 commit comments

Comments
 (0)