1 parent 4ebcc76 commit 136985cCopy full SHA for 136985c
1 file changed
src/modules/functions.ts
@@ -56,10 +56,11 @@ export function createFunctionsModule(
56
let contentType: string;
57
58
// Handle file uploads with FormData
59
- if (
60
- data instanceof FormData ||
61
- (data && Object.values(data).some((value) => value instanceof File))
62
- ) {
+ if (data instanceof FormData) {
+ // Preserve fields, repeated keys, and files already encoded by callers.
+ formData = data;
+ contentType = "multipart/form-data";
63
+ } else if (data && Object.values(data).some((value) => value instanceof File)) {
64
formData = new FormData();
65
Object.keys(data).forEach((key) => {
66
if (data[key] instanceof File) {
0 commit comments