From 5d33c34aa8af8bd2f0fe55d846cc36ced838b858 Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Sat, 11 Feb 2023 00:15:28 +0100 Subject: [PATCH] Revert "remove body parser settings for now" This reverts commit 41ce22aa1c718dde7585609da2addd75985394a0. --- packages/backend/src/server/api/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index fc6e0158d8..bfbc6a3fef 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -40,7 +40,14 @@ app.use(async (ctx, next) => { app.use(formidable()); app.use( - bodyParser(), + bodyParser({ + // リクエストが multipart/form-data でない限りはJSONだと見なす + detectJSON: (ctx) => + !( + ctx.is("multipart/form-data") || + ctx.is("application/x-www-form-urlencoded") + ), + }), ); // Init multer instance