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

Method ServeHTTP

pkg/serverinit/serverinit.go:846–860  ·  view source on GitHub ↗
(w http.ResponseWriter, _ *http.Request)

Source from the content-addressed store, hash-verified

844)
845
846func (h configHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
847 w.Header().Set("Content-Type", "text/plain; charset=utf-8")
848 b, _ := json.MarshalIndent(h.c.jconf, "", " ")
849 b = knownKeys.ReplaceAll(b, nil)
850 b = trailingComma.ReplaceAll(b, []byte("$1"))
851 b = sensitiveLine.ReplaceAllFunc(b, func(ln []byte) []byte {
852 i := bytes.IndexByte(ln, ':')
853 r := string(ln[:i+1]) + ` "REDACTED"`
854 if bytes.HasSuffix(bytes.TrimSpace(ln), []byte{','}) {
855 r += ","
856 }
857 return []byte(r + "\n")
858 })
859 w.Write(b)
860}
861
862// profileHandler publishes server profile information.
863type profileHandler struct{}

Callers

nothing calls this directly

Calls 2

SetMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected