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 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{}},