Changed send to sendStatus

This commit is contained in:
2023-03-12 14:16:17 +01:00
parent 4d4fb92ab5
commit 72385f0c11
+5 -4
View File
@@ -27,7 +27,7 @@ router.post(
}, },
//Huge mess to retrieve server id from expressBasicAuth. We probably should fix it. //Huge mess to retrieve server id from expressBasicAuth. We probably should fix it.
(req, res, next) => { (req, res, next) => {
if (!req) res.send(500) if (!req) res.sendStatus(500)
return expressBasicAuth({ return expressBasicAuth({
authorizeAsync: true, authorizeAsync: true,
authorizer: CheckServerToken.bind(req), authorizer: CheckServerToken.bind(req),
@@ -36,8 +36,9 @@ router.post(
} }
) )
//Route to check auth
router.post('/servers/:serverId', (req, res) => { router.post('/servers/:serverId', (req, res) => {
res.send(200) res.sendStatus(200)
}) })
const serversCount: { [id: string]: number } = {} const serversCount: { [id: string]: number } = {}
@@ -193,7 +194,7 @@ router.post(
distance distance
}) })
.then((e) => { .then((e) => {
res.send(201) res.sendStatus(201)
console.log( console.log(
`[${Date.now().toLocaleString()}] Kill submitted for server ${ `[${Date.now().toLocaleString()}] Kill submitted for server ${
req.body.serverId req.body.serverId
@@ -201,7 +202,7 @@ router.post(
) )
}) })
.catch((e) => { .catch((e) => {
res.send(500) res.sendStatus(500)
}) })
} }
) )