From 69141117bb36b5599e63f2c8ac45b15590cde1bf Mon Sep 17 00:00:00 2001 From: Devilmaydante <55410176+Devilmaydante@users.noreply.github.com> Date: Sat, 4 Nov 2023 00:50:44 +0100 Subject: [PATCH] Add raw body in request object accessible by req.rawBody --- lib/services/express.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/services/express.js b/lib/services/express.js index f333e501f..6acd9fce4 100644 --- a/lib/services/express.js +++ b/lib/services/express.js @@ -89,7 +89,14 @@ const initMiddleware = (app) => { extended: true, }), ); - app.use(bodyParser.json(config.bodyParser)); + app.use( + bodyParser.json({ + ...config.bodyParser, + verify: (req, res, buf) => { + req.rawBody = buf; + }, + }), + ); app.use(methodOverride()); // Add the cookie parser and flash middleware app.use(cookieParser());