Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: request failing on change content type to multipart-formdata (#3922)

Anwarul Islam6f4455ba033f
diff --git a/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts b/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts
index 1e331570f..a11400bfa 100644
--- a/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts
+++ b/packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts
@@ -274,7 +274,7 @@ function getFinalBodyFromRequest(
if (request.body.contentType === "application/x-www-form-urlencoded") {
const parsedBodyRecord = pipe(
- request.body.body,
+ request.body.body ?? "",
parseRawKeyValueEntriesE,
E.map(
flow(
@@ -311,7 +311,7 @@ function getFinalBodyFromRequest(
if (request.body.contentType === "multipart/form-data") {
return pipe(
- request.body.body,
+ request.body.body ?? [],
A.filter((x) => (x.key !== "" || x.isFile) && x.active), // Remove empty keys
// Sort files down
diff --git a/packages/hoppscotch-data/package.json b/packages/hoppscotch-data/package.json
index 92b029e0c..d6fa1fab3 100644
--- a/packages/hoppscotch-data/package.json
+++ b/packages/hoppscotch-data/package.json
@@ -10,6 +10,7 @@
"dist/*"
],
"scripts": {
+ "dev": "vite build --watch",
"build:code": "vite build",
"build:decl": "tsc --project tsconfig.decl.json",
"build": "pnpm run build:code && pnpm run build:decl",
@@ -46,4 +47,4 @@
"verzod": "0.2.2",
"zod": "3.22.4"
}
-}
\ No newline at end of file
+}