From 1b7504a191c8b67c83e7ef559e05c3e010ba35ad Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 8 May 2021 12:25:04 +1200 Subject: [PATCH] switch back to startsWith This is because application/json;charset=utf8 is perfectly valid! --- api/package.json | 2 +- api/src/api/v2.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/package.json b/api/package.json index 58ff057..a227cc2 100644 --- a/api/package.json +++ b/api/package.json @@ -17,7 +17,7 @@ }, "license": "MIT", "scripts": { - "lint": "prettier . --write" + "lint": "prettier . --write" }, "devDependencies": { "prettier": "2.2.1" diff --git a/api/src/api/v2.js b/api/src/api/v2.js index ceb06fd..d6b59a0 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -12,7 +12,7 @@ router.use((req, res, next) => { return next(); } - if (req.headers['content-type'] !== 'application/json') { + if (!req.headers['content-type'].startsWith('application/json')) { return res.status(415).send({ message: 'requests must be of type application/json', });