Skip to content

Commit 956ae0e

Browse files
committed
fix: prevent browser caching of API responses in MetadataInterceptor
1 parent 9cc970a commit 956ae0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/router/api/v1/connect_interceptors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (*MetadataInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc
5656

5757
// Prevent browser caching of API responses to avoid stale data issues
5858
// See: https://github.com/usememos/memos/issues/5470
59-
if resp != nil {
59+
if resp != nil && resp.Header() != nil {
6060
resp.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
6161
resp.Header().Set("Pragma", "no-cache")
6262
resp.Header().Set("Expires", "0")

0 commit comments

Comments
 (0)