Skip to content

Commit

Permalink
refactor: make Cache-Control on generated html optional
Browse files Browse the repository at this point in the history
This allows us to ship this as backward-compatible fix
  • Loading branch information
lidel committed Jul 29, 2024
1 parent 9cd2679 commit 1bf9a49
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/path_gateway_unixfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,23 @@ func TestGatewayCache(t *testing.T) {
tests := SugarTests{
{
Name: "GET for /ipfs/ unixfs dir listing succeeds",
Hint("UnixFS directory listings are generated HTML, which may change over time, and can't be cached forever. Still, should have a meaningful cache-control header."),

Check failure on line 87 in tests/path_gateway_unixfs_test.go

View workflow job for this annotation

GitHub Actions / go-check / All

mixture of field:value and value elements in struct literal
Request: Request().
Path("/ipfs/{{CID}}/root2/root3/", fixture.MustGetCid()),
Response: Expect().
Status(200).
Headers(
Header("Cache-Control").
Equals("public, max-age=604800, stale-while-revalidate=2678400"),
Header("X-Ipfs-Path").
Equals("/ipfs/{{CID}}/root2/root3/", fixture.MustGetCid()),
Header("X-Ipfs-Roots").
Equals("{{CID1}},{{CID2}},{{CID3}}", fixture.MustGetCid(), fixture.MustGetCid("root2"), fixture.MustGetCid("root2", "root3")),
Header("Etag").
Matches("DirIndex-.*_CID-{{cid}}", fixture.MustGetCid("root2", "root3")),
),
AnyOf(

Check failure on line 100 in tests/path_gateway_unixfs_test.go

View workflow job for this annotation

GitHub Actions / go-check / All

mixture of field:value and value elements in struct literal (compile)
Expect().Headers(Header("Cache-Control").IsEmpty()),
Expect().Headers(Header("Cache-Control").Equals("public, max-age=604800, stale-while-revalidate=2678400")),
),
},
{
Name: "GET for /ipfs/ unixfs dir with index.html succeeds",
Expand Down

0 comments on commit 1bf9a49

Please sign in to comment.