(label: string, data?: unknown)
| 10 | const DEBUG_URL = `http://localhost:${DEBUG_PORT}/debug`; |
| 11 | |
| 12 | async function sendLog(label: string, data?: unknown): Promise<boolean> { |
| 13 | try { |
| 14 | const res = await fetch(DEBUG_URL, { |
| 15 | method: "POST", |
| 16 | headers: { "Content-Type": "application/json" }, |
| 17 | body: JSON.stringify({ label, data }), |
| 18 | }); |
| 19 | return res.ok; |
| 20 | } catch (err) { |
| 21 | console.error(`Failed to send log "${label}":`, err); |
| 22 | return false; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | async function main() { |
| 27 | console.log(`Testing debug server at ${DEBUG_URL}\n`); |