From 0e52a0cd06c91a861c57b360db97220ca47ad17a Mon Sep 17 00:00:00 2001 From: MrUnknownDE Date: Sat, 29 Mar 2025 11:34:28 +0100 Subject: [PATCH] add debug in ping endpoint --- backend/server.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/server.js b/backend/server.js index 0724592..55b0a1b 100644 --- a/backend/server.js +++ b/backend/server.js @@ -212,7 +212,17 @@ app.get('/api/ipinfo', async (req, res) => { app.get('/api/ping', async (req, res) => { const targetIp = req.query.targetIp; + // --- DEBUGGING START --- + console.log(`--- PING Request ---`); + console.log(`Raw req.query.targetIp:`, req.query.targetIp); + console.log(`Type of targetIp:`, typeof targetIp); + console.log(`Value of targetIp before validation: "${targetIp}"`); + // --- DEBUGGING END --- + if (!isValidIp(targetIp)) { + // --- DEBUGGING START --- + console.log(`isValidIp returned false for "${targetIp}"`); + // --- DEBUGGING END --- return res.status(400).json({ error: 'Invalid target IP address provided.' }); }