fix(core): update
This commit is contained in:
parent
2114ff28c0
commit
907d51a842
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedserver',
|
||||
version: '3.0.23',
|
||||
version: '3.0.24',
|
||||
description: 'easy serving of static files'
|
||||
}
|
||||
|
@ -142,7 +142,24 @@ export class Server {
|
||||
});
|
||||
|
||||
// body parsing
|
||||
this.expressAppInstance.use(plugins.bodyParser.json({ limit: 100000000 })); // for parsing application/json
|
||||
this.expressAppInstance.use(async (req, res, next) => {
|
||||
if (req.headers['content-type'] === 'application/json') {
|
||||
let data = '';
|
||||
req.on('data', chunk => {
|
||||
data += chunk;
|
||||
});
|
||||
req.on('end', () => {
|
||||
try {
|
||||
req.body = plugins.smartjson.parse(data);
|
||||
next();
|
||||
} catch (error) {
|
||||
res.status(400).send('Invalid JSON');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
this.expressAppInstance.use(plugins.bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
||||
|
||||
// robots
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedserver',
|
||||
version: '3.0.23',
|
||||
version: '3.0.24',
|
||||
description: 'easy serving of static files'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user