From 53753bb5dd83fbc1e7253784b02f2b1f2e02fdb9 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Wed, 7 Sep 2022 17:14:25 +0300 Subject: [PATCH] fix(fetch): fix formData function --- .changeset/weak-dodos-cover.md | 5 +++++ packages/fetch/dist/getFormDataMethod.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/weak-dodos-cover.md diff --git a/.changeset/weak-dodos-cover.md b/.changeset/weak-dodos-cover.md new file mode 100644 index 00000000000..6e6b7b3f6c0 --- /dev/null +++ b/.changeset/weak-dodos-cover.md @@ -0,0 +1,5 @@ +--- +'@whatwg-node/fetch': patch +--- + +fix(fetch): fix formData function diff --git a/packages/fetch/dist/getFormDataMethod.js b/packages/fetch/dist/getFormDataMethod.js index 2530601662a..871e6a9fa56 100644 --- a/packages/fetch/dist/getFormDataMethod.js +++ b/packages/fetch/dist/getFormDataMethod.js @@ -58,7 +58,7 @@ module.exports = function getFormDataMethod(File, limits) { reject(new Error(`Fields limit exceeded: ${limits.fields}`)); }) bb.on('file', (name, fileStream, { filename, mimeType }) => { - if (limits.fieldsFirst) { + if (limits && limits.fieldsFirst) { resolve(formData); const fakeFileObj = { name: filename,