From f8c6f9ae74a0ba14bf410781753ca9746e74f017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Wed, 8 Apr 2026 18:37:23 +0100 Subject: [PATCH] feat(broker): add test endpoints for url watch validation Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/broker/src/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/broker/src/index.ts b/apps/broker/src/index.ts index c28fc67..4a86185 100644 --- a/apps/broker/src/index.ts +++ b/apps/broker/src/index.ts @@ -592,6 +592,21 @@ function handleHttpRequest(req: IncomingMessage, res: ServerResponse): void { return; } + // --- Test endpoints for URL watch validation --- + if (req.method === "GET" && req.url === "/test/clock") { + writeJson(res, 200, { time: new Date().toISOString(), epoch: Date.now() }); + return; + } + if (req.method === "GET" && req.url === "/test/flip") { + writeJson(res, 200, { value: Math.random() > 0.5 ? "heads" : "tails", at: Date.now() }); + return; + } + if (req.method === "GET" && req.url === "/test/html") { + res.writeHead(200, { "Content-Type": "text/html" }); + res.end(`

Updated at ${new Date().toISOString()}

Counter: ${Date.now()}

`); + return; + } + res.writeHead(404); res.end("not found"); log.debug("http", { route, status: 404, latency_ms: Date.now() - started });