mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 05:05:44 +08:00
fix: 空json5
This commit is contained in:
parent
8fc13f8a8f
commit
da24ae7e1c
@ -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));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user