Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.1] - 2024-07-29
### Changed
- Support meaningful `Cache-Control` on generated UnixFS directory listing responses on `/ipfs` namespace

## [0.6.0] - 2024-06-10
### Changed
- Gateway URL
Expand Down
27 changes: 16 additions & 11 deletions tests/path_gateway_unixfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,25 @@ 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.",
Request: Request().
Path("/ipfs/{{CID}}/root2/root3/", fixture.MustGetCid()),
Response: Expect().
Status(200).
Headers(
Header("Cache-Control").
IsEmpty(),
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")),
Response: AllOf(
Expect().
Status(200).
Headers(
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(
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