Skip to content

Commit

Permalink
chore: apply feedback suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
hacdias and lidel authored Jun 26, 2023
1 parent cec853f commit ca2a9f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestHeaders(t *testing.T) {
dagCborRoots = dirRoots + "," + dagCborCID
)

t.Run("Control-Cache-Immutable is not immutable for directories", func(t *testing.T) {
t.Run("Cache-Control is not immutable on generated /ipfs/ HTML dir listings", func(t *testing.T) {
req := mustNewRequest(t, http.MethodGet, ts.URL+"/ipfs/"+root.String()+"/", nil)
res := mustDoWithoutRedirect(t, req)

Expand All @@ -163,7 +163,7 @@ func TestHeaders(t *testing.T) {
}
})

t.Run("ETag contains expected values", func(t *testing.T) {
t.Run("ETag is based on CID and response format", func(t *testing.T) {
test := func(responseFormat string, path string, format string, args ...any) {
t.Run(responseFormat, func(t *testing.T) {
url := ts.URL + path
Expand Down
4 changes: 3 additions & 1 deletion gateway/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ type requestData struct {
resolvedPath *ImmutablePath
}

func (rq *requestData) maybeResolvedPath() ImmutablePath {
// mostlyResolvedPath is an opportunistic optimization that returns the mostly resolved version of ImmutablePath available.
// It does not guarantee it is fully resolved, nor that it is the original.
func (rq *requestData) mostlyResolvedPath() ImmutablePath {
if rq.resolvedPath != nil {
return *rq.resolvedPath
}
Expand Down

0 comments on commit ca2a9f8

Please sign in to comment.