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

Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
Anwarul Islam
2024-03-22 18:41:16 +06:00
committed by GitHub
parent ba8c4480d9
commit 6f4455ba03
2 changed files with 4 additions and 3 deletions

View File

@@ -274,7 +274,7 @@ function getFinalBodyFromRequest(
if (request.body.contentType === "application/x-www-form-urlencoded") { if (request.body.contentType === "application/x-www-form-urlencoded") {
const parsedBodyRecord = pipe( const parsedBodyRecord = pipe(
request.body.body, request.body.body ?? "",
parseRawKeyValueEntriesE, parseRawKeyValueEntriesE,
E.map( E.map(
flow( flow(
@@ -311,7 +311,7 @@ function getFinalBodyFromRequest(
if (request.body.contentType === "multipart/form-data") { if (request.body.contentType === "multipart/form-data") {
return pipe( return pipe(
request.body.body, request.body.body ?? [],
A.filter((x) => (x.key !== "" || x.isFile) && x.active), // Remove empty keys A.filter((x) => (x.key !== "" || x.isFile) && x.active), // Remove empty keys
// Sort files down // Sort files down

View File

@@ -10,6 +10,7 @@
"dist/*" "dist/*"
], ],
"scripts": { "scripts": {
"dev": "vite build --watch",
"build:code": "vite build", "build:code": "vite build",
"build:decl": "tsc --project tsconfig.decl.json", "build:decl": "tsc --project tsconfig.decl.json",
"build": "pnpm run build:code && pnpm run build:decl", "build": "pnpm run build:code && pnpm run build:decl",
@@ -46,4 +47,4 @@
"verzod": "0.2.2", "verzod": "0.2.2",
"zod": "3.22.4" "zod": "3.22.4"
} }
} }