Parse json bodies for application/*+json too

This commit is contained in:
Alice Gaudon 2020-08-28 17:40:04 +02:00
parent cf8039c2c7
commit 3af1f4a4e5
1 changed files with 3 additions and 1 deletions

View File

@ -26,7 +26,9 @@ export default class ExpressAppComponent extends ApplicationComponent<void> {
}
public async init(router: Router): Promise<void> {
router.use(express.json());
router.use(express.json({
type: req => req.headers['content-type']?.match(/^application\/(.+\+)?json$/)
}));
router.use(express.urlencoded({
extended: true,
}));