Incepere creare procese separate
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const { sendResponse } = require('../helpers/responseHelper');
|
||||
const {httpStatus, httpStatusMessages} = require("../helpers/httpResponses");
|
||||
|
||||
const {httpStatus} = require("../helpers/httpResponses");
|
||||
|
||||
function checkJson(req, res, next) {
|
||||
if(req.method === 'GET'){
|
||||
@@ -7,7 +7,7 @@ function checkJson(req, res, next) {
|
||||
}
|
||||
|
||||
if (['POST', 'PUT', 'PATCH'].includes(req.method) && req.headers['content-type'] !== 'application/json') {
|
||||
return sendResponse(res, httpStatus.BAD_REQUEST, httpStatusMessages[httpStatus.BAD_REQUEST]);
|
||||
return res.status(httpStatus.BAD_REQUEST).json({message: "Body missing in action."});
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user