tests: cover media nosniff header

This commit is contained in:
George Pickett
2026-03-03 12:59:16 -08:00
parent 452698b209
commit bb501cfcb1
2 changed files with 3 additions and 0 deletions

View File

@@ -0,0 +1 @@
- Security/Media route: add `X-Content-Type-Options: nosniff` header regression assertions for successful and not-found media responses (#30356) (thanks @13otKmdr)

View File

@@ -61,6 +61,7 @@ describe("media server", () => {
const file = await writeMediaFile("file1", "hello");
const res = await fetch(mediaUrl("file1"));
expect(res.status).toBe(200);
expect(res.headers.get("x-content-type-options")).toBe("nosniff");
expect(await res.text()).toBe("hello");
await waitForFileRemoval(file);
});
@@ -113,6 +114,7 @@ describe("media server", () => {
it("returns not found for missing media IDs", async () => {
const res = await fetch(mediaUrl("missing-file"));
expect(res.status).toBe(404);
expect(res.headers.get("x-content-type-options")).toBe("nosniff");
expect(await res.text()).toBe("not found");
});