From abe27b746c5ffcaa7857f55cd0cc7fb8dce6ae08 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Thu, 4 Aug 2022 22:17:49 +0700 Subject: [PATCH] fix: routes/nojs --- routes/nojs.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/routes/nojs.js b/routes/nojs.js index db34c0d..cea0953 100644 --- a/routes/nojs.js +++ b/routes/nojs.js @@ -12,7 +12,10 @@ routes.get('/nojs', async (req, res) => { }) }) -routes.post('/nojs', async (req, res) => { +// HyperExpress defaults to 250kb +// https://github.com/kartikk221/hyper-express/blob/6.4.4/docs/Server.md#server-constructor-options +const maxBodyLength = parseInt(config.uploads.maxSize) * 1e6 +routes.post('/nojs', { max_body_length: maxBodyLength }, async (req, res) => { res._json = res.json res.json = (...args) => { const result = args[0] @@ -25,10 +28,6 @@ routes.post('/nojs', async (req, res) => { }) } return upload.upload(req, res) -}, { - // HyperExpress defaults to 250kb - // https://github.com/kartikk221/hyper-express/blob/6.2.4/docs/Server.md#server-constructor-options - max_body_length: parseInt(config.uploads.maxSize) * 1e6 }) module.exports = routes