From 24c55d870852b528e8c01d5039945ee739f71b51 Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 31 Mar 2021 21:12:14 +0200 Subject: [PATCH] move body splitting inside try block --- routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes.js b/routes.js index 17ed3d9..28ffddd 100644 --- a/routes.js +++ b/routes.js @@ -1734,8 +1734,8 @@ module.exports = (app, redis, fetch, RedditAPI) => { }) req.on('end', () => { body = body.toString() - let json = body.split('Content-Type: application/json')[1].trim().split('--')[0] try { + let json = body.split('Content-Type: application/json')[1].trim().split('--')[0] let prefs = JSON.parse(json) resetPreferences(res) for(var setting in prefs) {