MCPcopy Create free account
hub / github.com/dispatchrun/wzprof / serveProfile

Function serveProfile

pprof.go:46–54  ·  view source on GitHub ↗

Copyright (c) 2009 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions an

(w http.ResponseWriter, prof *profile.Profile)

Source from the content-addressed store, hash-verified

44// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45
46func serveProfile(w http.ResponseWriter, prof *profile.Profile) {
47 h := w.Header()
48 h.Set("X-Content-Type-Options", "nosniff")
49 h.Set("Content-Type", "application/octet-stream")
50 h.Set("Content-Disposition", `attachment; filename="profile"`)
51 if err := prof.Write(w); err != nil {
52 serveError(w, http.StatusInternalServerError, err.Error())
53 }
54}
55
56func serveError(w http.ResponseWriter, status int, txt string) {
57 h := w.Header()

Callers 2

NewHandlerMethod · 0.85
NewHandlerMethod · 0.85

Calls 1

serveErrorFunction · 0.85

Tested by

no test coverage detected