add debug in ping endpoint

This commit is contained in:
2025-03-29 11:34:28 +01:00
parent 5266b05ce3
commit 0e52a0cd06

View File

@@ -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.' });
}