mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: 空json5
This commit is contained in:
@@ -59,12 +59,15 @@ export class OB11HttpServerAdapter extends IOB11NetworkAdapter<HttpServerConfig>
|
|||||||
});
|
});
|
||||||
req.on('end', () => {
|
req.on('end', () => {
|
||||||
try {
|
try {
|
||||||
req.body = json5.parse(rawData);
|
req.body = json5.parse(rawData || '{}');
|
||||||
next();
|
next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return res.status(400).send('Invalid JSON');
|
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));
|
this.app.use((req, res, next) => this.authorize(this.config.token, req, res, next));
|
||||||
|
Reference in New Issue
Block a user