Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(studio-server): a cached-only thumbnail miss answers 204, so the page logs no error (#4652)
Miguel Ángel34a66744f27a
diff --git a/packages/studio-server/src/routes/thumbnail.test.ts b/packages/studio-server/src/routes/thumbnail.test.tsindex db93da09a8..5b17144821 100644--- a/packages/studio-server/src/routes/thumbnail.test.ts+++ b/packages/studio-server/src/routes/thumbnail.test.ts@@ -130,14 +130,17 @@ describe("registerThumbnailRoutes", () => {);});- it("answers a cache-only request from the cache and never renders on a miss", async () => {+ it("answers a cache-only request from the cache, with no content and no render on a miss", async () => {const adapter = createAdapter();await writeComposition(adapter, 1920, 1080);const app = new Hono();registerThumbnailRoutes(app, adapter);const url = "http://localhost/projects/demo/thumbnail/index.html?t=0&output=source";- expect((await app.request(`${url}&cached=1`)).status).toBe(404);+ const miss = await app.request(`${url}&cached=1`);+ expect(miss.status).toBe(204);+ expect(miss.headers.get("Cache-Control")).toBe("no-cache");+ expect(await miss.text()).toBe("");expect(adapter.generateThumbnail).not.toHaveBeenCalled();expect((await app.request(url)).status).toBe(200);diff --git a/packages/studio-server/src/routes/thumbnail.ts b/packages/studio-server/src/routes/thumbnail.tsindex 543486c9d6..888c3d689d 100644--- a/packages/studio-server/src/routes/thumbnail.ts+++ b/packages/studio-server/src/routes/thumbnail.ts@@ -216,7 +216,8 @@ export function registerThumbnailRoutes(api: Hono, adapter: StudioApiAdapter): vheaders: { "Content-Type": contentType, "Cache-Control": "no-cache" },});}- if (url.searchParams.get("cached") === "1") return c.body(null, 404);+ if (url.searchParams.get("cached") === "1")+ return c.body(null, 204, { "Cache-Control": "no-cache" });try {const buffer = await thumbnailGenerationCoordinator.acquire(