From 3e2f736cb16df415cc07126bd886be1c3c250b2e Mon Sep 17 00:00:00 2001 From: ImVaskel <49348256+ImVaskel@users.noreply.github.com> Date: Fri, 1 Oct 2021 14:14:14 -0400 Subject: [PATCH] make 404 return json instead of text --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 910fdc3..dcb9505 100644 --- a/index.js +++ b/index.js @@ -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; }