From 3862d6e6721793d78add9acf5b14fd9a8f7a5b60 Mon Sep 17 00:00:00 2001 From: Joey Pender Date: Thu, 14 Dec 2023 10:23:36 -0600 Subject: [PATCH] fix(http): set formdata boundary and body when content-type not explicitly set (#7133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Chace Daniels Co-authored-by: Dan Giralté <97970732+giralte-ionic@users.noreply.github.com> --- core/src/core-plugins.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/core-plugins.ts b/core/src/core-plugins.ts index dcce08e63..fb1d48c38 100644 --- a/core/src/core-plugins.ts +++ b/core/src/core-plugins.ts @@ -318,7 +318,10 @@ export const buildRequestInit = ( params.set(key, value as any); } output.body = params.toString(); - } else if (type.includes('multipart/form-data')) { + } else if ( + type.includes('multipart/form-data') || + options.data instanceof FormData + ) { const form = new FormData(); if (options.data instanceof FormData) { options.data.forEach((value, key) => {