mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-10 17:58:16 +00:00
fix(httpcache): raw files return 304 after a change when the new commit is older (#39435)
This commit is contained in:
1 parent
db7d1da28f
commit
6809ecf2d2
2 files changed
+16
-1
No files matched your search
@@ -76,6 +76,19 @@ func TestHandleGenericETagCache(t *testing.T) {
|
||||
wantHeaders: map[string]string{"Last-Modified": lastModified, "Cache-Control": "", "Etag": weakEtag},
|
||||
wantStatus: http.StatusNotModified,
|
||||
},
|
||||
{
|
||||
name: "If-Modified-Since without If-None-Match",
|
||||
reqHeaders: map[string]string{"If-Modified-Since": lastModified},
|
||||
wantHandled: true,
|
||||
wantHeaders: map[string]string{"Last-Modified": lastModified, "Cache-Control": "", "Etag": matchedEtag},
|
||||
wantStatus: http.StatusNotModified,
|
||||
},
|
||||
{
|
||||
name: "Mismatched If-None-Match takes precedence over If-Modified-Since",
|
||||
reqHeaders: map[string]string{"If-None-Match": `"mismatched-etag"`, "If-Modified-Since": lastModified},
|
||||
wantHandled: false,
|
||||
wantHeaders: map[string]string{"Last-Modified": lastModified, "Cache-Control": cacheControl, "Etag": matchedEtag},
|
||||
},
|
||||
{
|
||||
name: "Multiple Matched If-None-Match",
|
||||
reqHeaders: map[string]string{"If-None-Match": `"mismatched-etag", ` + matchedEtag},
|
||||
|
||||
Reference in new issue
Block a user