Skip to content
Open
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
1 change: 1 addition & 0 deletions internal/validationresponsehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions internal/validationresponsehandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}},
Expand Down