diff --git a/packages/core/useFetch/index.ts b/packages/core/useFetch/index.ts index c5d864c920c..c03808e35e5 100644 --- a/packages/core/useFetch/index.ts +++ b/packages/core/useFetch/index.ts @@ -95,7 +95,6 @@ type Combination = 'overwrite' | 'chain' const payloadMapping: Record = { json: 'application/json', text: 'text/plain', - formData: 'multipart/form-data', } export interface BeforeFetchContext { @@ -532,9 +531,9 @@ export function useFetch(url: MaybeComputedRef, ...args: any[]): UseF } const rawPayload = resolveUnref(config.payload) - // Set the payload to json type only if it's not provided and a literal object is provided + // Set the payload to json type only if it's not provided and a literal object is provided and the object is not `formData` // The only case we can deduce the content type and `fetch` can't - if (!payloadType && rawPayload && Object.getPrototypeOf(rawPayload) === Object.prototype) + if (!payloadType && rawPayload && Object.getPrototypeOf(rawPayload) === Object.prototype && !(rawPayload instanceof FormData)) config.payloadType = 'json' return {