(w http.ResponseWriter, req *http.Request)
| 820 | type expvarHandler struct{} |
| 821 | |
| 822 | func (expvarHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { |
| 823 | w.Header().Set("Content-Type", "application/json; charset=utf-8") |
| 824 | fmt.Fprintf(w, "{\n") |
| 825 | first := true |
| 826 | expvar.Do(func(kv expvar.KeyValue) { |
| 827 | if !first { |
| 828 | fmt.Fprintf(w, ",\n") |
| 829 | } |
| 830 | first = false |
| 831 | fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value) |
| 832 | }) |
| 833 | fmt.Fprintf(w, "\n}\n") |
| 834 | } |
| 835 | |
| 836 | type configHandler struct { |
| 837 | c *Config |