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)
| 44 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 45 | |
| 46 | func 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 | |
| 56 | func serveError(w http.ResponseWriter, status int, txt string) { |
| 57 | h := w.Header() |
no test coverage detected