move body splitting inside try block

This commit is contained in:
teddit 2021-03-31 21:12:14 +02:00
parent 156c7ba40a
commit 24c55d8708
1 changed files with 1 additions and 1 deletions

View File

@ -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) {