MCPcopy
hub / github.com/perkeep/perkeep / ServeHTTP

Method ServeHTTP

pkg/server/status.go:96–114  ·  view source on GitHub ↗
(rw http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

94}
95
96func (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
116type status struct {
117 Version string `json:"version"`

Callers

nothing calls this directly

Calls 6

serveRestartMethod · 0.95
serveStatusJSONMethod · 0.95
serveStatusHTMLMethod · 0.95
PathSuffixFunction · 0.92
IsGetFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected