(rw http.ResponseWriter, req *http.Request)
| 94 | } |
| 95 | |
| 96 | func (sh *StatusHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) { |
| 97 | suffix := httputil.PathSuffix(req) |
| 98 | if suffix == "restart" { |
| 99 | sh.serveRestart(rw, req) |
| 100 | return |
| 101 | } |
| 102 | if !httputil.IsGet(req) { |
| 103 | http.Error(rw, "Illegal status method.", http.StatusMethodNotAllowed) |
| 104 | return |
| 105 | } |
| 106 | switch suffix { |
| 107 | case "status.json": |
| 108 | sh.serveStatusJSON(rw, req) |
| 109 | case "": |
| 110 | sh.serveStatusHTML(rw, req) |
| 111 | default: |
| 112 | http.Error(rw, "Illegal status path.", http.StatusNotFound) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | type status struct { |
| 117 | Version string `json:"version"` |
nothing calls this directly
no test coverage detected