From 871248eda7bcd2d50f18110c38fce83d0a2b729a Mon Sep 17 00:00:00 2001 From: Inhyuk Andy Cho Date: Mon, 5 Jan 2026 09:12:39 +0900 Subject: [PATCH 1/2] fix: update cache on validation --- internal/validationresponsehandler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/validationresponsehandler.go b/internal/validationresponsehandler.go index 292e705..3c06403 100644 --- a/internal/validationresponsehandler.go +++ b/internal/validationresponsehandler.go @@ -81,6 +81,7 @@ func (r *validationResponseHandler) HandleValidationResponse( // RFC 9111 §4.3.3 Handling Validation Responses (304 Not Modified) // RFC 9111 §4.3.4 Freshening Stored Responses upon Validation updateStoredHeaders(ctx.Stored.Data, resp) + _ = r.rs.StoreResponse(req, ctx.Stored.Data, ctx.URLKey, ctx.Refs, ctx.Start, ctx.End, ctx.RefIndex) CacheStatusRevalidated.ApplyTo(ctx.Stored.Data.Header) r.l.LogCacheRevalidated(req, ctx.URLKey, ctx.ToMisc(nil)) return ctx.Stored.Data, nil From e8f96db7d5465b3d2ffd9da1ff6606c929efe7ec Mon Sep 17 00:00:00 2001 From: Inhyuk Andy Cho Date: Tue, 20 Jan 2026 19:39:01 +0900 Subject: [PATCH 2/2] test: add ResponseStorer for 304 --- internal/validationresponsehandler_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/validationresponsehandler_test.go b/internal/validationresponsehandler_test.go index e2e8740..9c6aafd 100644 --- a/internal/validationresponsehandler_test.go +++ b/internal/validationresponsehandler_test.go @@ -65,6 +65,14 @@ func Test_validationResponseHandler_HandleValidationResponse(t *testing.T) { l: noopLogger, }, setup: func(tt *testing.T, handler *validationResponseHandler) args { + handler.rs = &MockResponseStorer{ + StoreResponseFunc: func(req *http.Request, resp *http.Response, key string, headers ResponseRefs, reqTime, respTime time.Time, refIndex int) error { + testutil.AssertEqual(tt, "key", key) + testutil.AssertTrue(tt, respTime.Equal(base)) + testutil.AssertTrue(tt, reqTime.Equal(base)) + return nil + }, + } return args{ req: &http.Request{Method: http.MethodGet}, resp: &http.Response{StatusCode: http.StatusNotModified, Header: http.Header{}},