(w io.Writer, i interface{})
| 23 | } |
| 24 | |
| 25 | func 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 | |
| 37 | type varLookupFunc func(req *http.Request) string |