mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
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.
15 lines
625 B
TypeScript
15 lines
625 B
TypeScript
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");
|
|
});
|
|
});
|