mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(admin-api): bypass browser cache locks for live requests
Use no-store on both client requests and admin responses. Personalized live data must not be reused, and one stalled same-URL cache entry must not block later log requests behind the browser cache lock.
This commit is contained in:
1 parent
6cdcedde92
commit
82206b066a
3 files changed
+27
-1
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { describe, it, expect } from "bun:test";
|
||||
import handler from "../server/routes/admin/api/[...slug]";
|
||||
import { makeEvent, responseHeader, responseStatus } from "./helpers";
|
||||
|
||||
describe("admin API route", () => {
|
||||
it("never lets a response be cached", async () => {
|
||||
const event = makeEvent("/admin/api/nope", { env: { GITHUB_WEBHOOK_SECRET: "s" } as never });
|
||||
event.context.params = { slug: "nope" };
|
||||
const res = await handler(event);
|
||||
expect(responseStatus(event)).toBe(404);
|
||||
expect(res).toEqual({ error: "Not found" });
|
||||
expect(responseHeader(event, "cache-control")).toBe("no-store");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user