switch back to startsWith

This is because application/json;charset=utf8 is perfectly valid!
This commit is contained in:
Thomas Hobson 2021-05-08 12:25:04 +12:00
parent 4259e89bb2
commit 1b7504a191
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@
}, },
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"lint": "prettier . --write" "lint": "prettier . --write"
}, },
"devDependencies": { "devDependencies": {
"prettier": "2.2.1" "prettier": "2.2.1"

View File

@ -12,7 +12,7 @@ router.use((req, res, next) => {
return next(); return next();
} }
if (req.headers['content-type'] !== 'application/json') { if (!req.headers['content-type'].startsWith('application/json')) {
return res.status(415).send({ return res.status(415).send({
message: 'requests must be of type application/json', message: 'requests must be of type application/json',
}); });