(wrt http.ResponseWriter, req *http.Request)
| 29 | } |
| 30 | |
| 31 | func profileHandler(wrt http.ResponseWriter, req *http.Request) { |
| 32 | wrt.Header().Set("X-Content-Type-Options", "nosniff") |
| 33 | wrt.Header().Set("Content-Type", "text/plain; charset=utf-8") |
| 34 | |
| 35 | profileName := strings.TrimPrefix(req.URL.Path, pprofHttpRoot) |
| 36 | |
| 37 | profile := pprof.Lookup(profileName) |
| 38 | if profile == nil { |
| 39 | servePprofError(wrt, http.StatusNotFound, "Unknown profile '"+profileName+"'") |
| 40 | return |
| 41 | } |
| 42 | |
| 43 | // Respond with the requested profile. |
| 44 | profile.WriteTo(wrt, 2) |
| 45 | } |
| 46 | |
| 47 | func servePprofError(wrt http.ResponseWriter, status int, txt string) { |
| 48 | wrt.Header().Set("Content-Type", "text/plain; charset=utf-8") |
nothing calls this directly
no test coverage detected
searching dependent graphs…