Add requireJson middleware

This commit is contained in:
Fred Boniface 2023-04-07 17:53:49 +01:00
parent b45aacc25a
commit 5af6122646

View File

@ -0,0 +1,9 @@
const log = require('../utils/log.utils')
module.exports = async function requireJson(req, res, next) {
if (req.headers['content-type'] !== 'application/json') {
res.status(400).send({status: 400, message: "Server requires JSON"})
} else {
next()
}
}