mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-05 07:48:18 +00:00
Test empty cache directive lists
This commit is contained in:
1 parent
0e891998fd
commit
988a10974b
1 file changed
+14
@@ -77,6 +77,20 @@ describe("native request header creation", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
["", "no-cache"],
|
||||||
|
[", , ,", "no-cache"],
|
||||||
|
[" , no-transform , , ", "no-transform, no-cache"],
|
||||||
|
])("ignores empty header-list members in %j", (value, expected) => {
|
||||||
|
const headers = Object.freeze({ "Cache-Control": value, Pragma: " , , " });
|
||||||
|
|
||||||
|
expect(createNativeRequestHeaders(headers, "GET", "no-cache")).toEqual({
|
||||||
|
"Cache-Control": expected,
|
||||||
|
Pragma: "no-cache",
|
||||||
|
});
|
||||||
|
expect(headers["Cache-Control"]).toBe(value);
|
||||||
|
});
|
||||||
|
|
||||||
it("retains cache headers on a non-revalidated method", () => {
|
it("retains cache headers on a non-revalidated method", () => {
|
||||||
const headers = { "cache-control": "max-age=99", Pragma: "legacy" };
|
const headers = { "cache-control": "max-age=99", Pragma: "legacy" };
|
||||||
expect(createNativeRequestHeaders(headers, "POST", "no-store")).toEqual(headers);
|
expect(createNativeRequestHeaders(headers, "POST", "no-store")).toEqual(headers);
|
||||||
|
|||||||
Reference in new issue
Block a user