Merge pull request #24 from ImVaskel/features/json-errors

make 404 return json instead of text
This commit is contained in:
ArcaneDisgea 2021-10-01 14:24:29 -04:00 committed by GitHub
commit 77b5cb5e76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -67,7 +67,7 @@ app.get('/prepare/name/:world/:charName', async (req, res) => {
var id = await getCharIdByName(req.params.world, req.params.charName);
if (id === undefined) {
res.status(404).send("Character not found.");
res.status(404).send({status: "error", reason: "Character not found."});
return;
}
@ -132,7 +132,7 @@ app.get('/characters/name/:world/:charName.png', async (req, res) => {
var id = await getCharIdByName(req.params.world, req.params.charName);
if (id === undefined) {
res.status(404).send("Character not found.");
res.status(404).send({status: "error", reason: "Character not found."});
return;
}