Update
This commit is contained in:
parent
5a64568824
commit
a748b93133
7 changed files with 81 additions and 27 deletions
9
backend/app/config/checkFormat.config.js
Normal file
9
backend/app/config/checkFormat.config.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
const {sendError} = require ("./response.config");
|
||||
|
||||
function checkFormat(req, res){
|
||||
if(req.get('Content-Type') !== 'application/json') {
|
||||
return sendError(res, 401, -1, "Invalid header format (please use JSON)");
|
||||
}
|
||||
return true; // Is valid
|
||||
}
|
||||
module.exports = checkFormat
|
||||
Reference in a new issue