From ef234287533964a3d696757edf5407c672b1f196 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Mon, 15 May 2023 22:00:46 +0000 Subject: [PATCH] fix error handling in ticket endpoint Signed-off-by: Arthur Lu --- main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.js b/main.js index af51613..fa6727e 100644 --- a/main.js +++ b/main.js @@ -43,6 +43,11 @@ app.post("/api/proxmox/*", async (req, res) => { // proxy endpoint for POST prox app.post("/api/ticket", async (req, res) => { let response = await requestPVE("/access/ticket", "POST", null, JSON.stringify(req.body)); + if (!response.ok) { + res.status(response.status).send({auth: false}); + res.end(); + return; + } let ticket = response.data.data.ticket; let csrftoken = response.data.data.CSRFPreventionToken; let username = response.data.data.username;