| gio | 5994628 | 2024-10-07 12:55:51 +0400 | [diff] [blame] | 1 | package server |
| 2 | |||||
| 3 | import ( | ||||
| 4 | "net/http" | ||||
| 5 | ) | ||||
| 6 | |||||
| 7 | type cachingHandler struct { | ||||
| 8 | h http.Handler | ||||
| 9 | } | ||||
| 10 | |||||
| 11 | func NewCachingHandler(h http.Handler) http.Handler { | ||||
| 12 | return cachingHandler{h} | ||||
| 13 | } | ||||
| 14 | |||||
| 15 | func (h cachingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | ||||
| 16 | w.Header().Set("Cache-Control", "max-age=604800") | ||||
| 17 | h.h.ServeHTTP(w, r) | ||||
| 18 | } | ||||