API-25: Proper error for wrong content-type header
All checks were successful
Jenkins Production Deployment

This commit is contained in:
Patrick Müller 2021-08-29 17:24:50 +02:00
parent cae471105e
commit 94b53aff4c
2 changed files with 12 additions and 0 deletions

View File

@ -36,6 +36,12 @@ loginRouter.post('/:isDevCall', async (req: Request, res: Response) => {
username = (req.query.username ?? '').toString();
email = (req.query.email ?? '').toString();
password = (req.query.password ?? '').toString();
} else {
res.status(400).send({
'status': 'WRONG_CONTENT_TYPE',
'message': 'The transmitted content-type is not supported'
});
return;
}
let userIP = req.socket.remoteAddress ?? '';
let deviceInfo = req.headers['user-agent'] ?? '';

View File

@ -42,6 +42,12 @@ registerRouter.post('/:isDevCall', async (req: Request, res: Response) => {
firstName = (req.query.firstName ?? '').toString();
lastName = (req.query.lastName ?? '').toString();
password = (req.query.password ?? '').toString();
} else {
res.status(400).send({
'status': 'WRONG_CONTENT_TYPE',
'message': 'The transmitted content-type is not supported'
});
return;
}
let userIP = req.socket.remoteAddress ?? '';
let deviceInfo = req.headers['user-agent'] ?? '';