fix: 空json5
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s

This commit is contained in:
手瓜一十雪 committed 2025-01-27 19:30:45 +08:00
1 parent 8fc13f8a8f
commit da24ae7e1c
1 file changed
+4 -1
+4 -1
View File
@@ -59,12 +59,15 @@ export class OB11HttpServerAdapter extends IOB11NetworkAdapter<HttpServerConfig>
});
req.on('end', () => {
try {
req.body = json5.parse(rawData);
req.body = json5.parse(rawData || '{}');
next();
} catch (err) {
return res.status(400).send('Invalid JSON');
}
});
req.on('error', (err) => {
return res.status(400).send('Invalid JSON');
});
});
this.app.use((req, res, next) => this.authorize(this.config.token, req, res, next));