From 31626ced30c3b87a8c16d9de19901d82c905629b Mon Sep 17 00:00:00 2001 From: Ayush7614 Date: Wed, 2 Sep 2026 14:12:31 +0530 Subject: [PATCH] feat(control-api): add GET /__aimock/fixtures introspection endpoint Returns the current number of loaded fixtures as { count }. Useful for CI debugging, health checks, and verifying fixture loads after dynamic POST /__aimock/fixtures adds or DELETE clears. The endpoint is read-only, CORS-enabled, and respects inbound API-key auth like the other control routes. --- src/server.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/server.ts b/src/server.ts index 7a77f46f..ece104ac 100644 --- a/src/server.ts +++ b/src/server.ts @@ -350,6 +350,13 @@ async function handleControlAPI( return true; } + // GET /__aimock/fixtures — inspect current fixture count + if (subPath === "/fixtures" && req.method === "GET") { + res.writeHead(200, { "Content-Type": "application/json" }); + res.end(JSON.stringify({ count: fixtures.length })); + return true; + } + // POST /__aimock/fixtures — add fixtures dynamically if (subPath === "/fixtures" && req.method === "POST") { let raw: string;