MCPcopy
hub / github.com/uber/aresdb / NoCache

Function NoCache

utils/http.go:62–77  ·  view source on GitHub ↗

NoCache sets no cache headers and removes any ETag headers that may have been set.

(h http.Handler)

Source from the content-addressed store, hash-verified

60
61// NoCache sets no cache headers and removes any ETag headers that may have been set.
62func NoCache(h http.Handler) http.Handler {
63 fn := func(w http.ResponseWriter, r *http.Request) {
64 for _, v := range etagHeaders {
65 if r.Header.Get(v) != "" {
66 r.Header.Del(v)
67 }
68 }
69
70 for k, v := range noCacheHeaders {
71 w.Header().Set(k, v)
72 }
73
74 h.ServeHTTP(w, r)
75 }
76 return http.HandlerFunc(fn)
77}
78
79// responseWriter is the wrapper over http.ResponseWriter to store status code. Unfortunately from built in
80// http.ResponseWriter we cannot get status code.

Callers 3

startFunction · 0.92
newHandlersMethod · 0.92
http_test.goFile · 0.85

Calls 4

ServeHTTPMethod · 0.80
GetMethod · 0.65
SetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected