MCPcopy Create free account
hub / github.com/couchbase/cbft / mustEncode

Function mustEncode

http/util.go:25–35  ·  view source on GitHub ↗
(w io.Writer, i interface{})

Source from the content-addressed store, hash-verified

23}
24
25func mustEncode(w io.Writer, i interface{}) {
26 if headered, ok := w.(http.ResponseWriter); ok {
27 headered.Header().Set("Cache-Control", "no-cache")
28 headered.Header().Set("Content-type", "application/json")
29 }
30
31 e := json.NewEncoder(w)
32 if err := e.Encode(i); err != nil {
33 log.Warnf("ftsHttp mustEncode error: %v", err)
34 }
35}
36
37type varLookupFunc func(req *http.Request) string

Callers 8

ServeHTTPMethod · 0.70
ServeHTTPMethod · 0.70
ServeHTTPMethod · 0.70
ServeHTTPMethod · 0.70
ServeHTTPMethod · 0.70
ServeHTTPMethod · 0.70
ServeHTTPMethod · 0.70
AnalyzeDocFunction · 0.50

Calls 2

HeaderMethod · 0.80
EncodeMethod · 0.80

Tested by

no test coverage detected