trace: properly set the content type when sending html
Without this, if the responses are compressed, Chrome's content-type
detection will fail and it will attempt to download these pages rather
than render them as HTML.
Change-Id: Ib5f803f335d55a00a759de85d38855ee0ae13ee0
Reviewed-on: https://go-review.googlesource.com/18230
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/trace/trace.go b/trace/trace.go
index c44cb7e..0767c8c 100644
--- a/trace/trace.go
+++ b/trace/trace.go
@@ -113,6 +113,7 @@
http.Error(w, "not allowed", http.StatusUnauthorized)
return
}
+ w.Header().Set("Content-Type", "text/html; charset=utf-8")
Render(w, req, sensitive)
})
http.HandleFunc("/debug/events", func(w http.ResponseWriter, req *http.Request) {
@@ -121,6 +122,7 @@
http.Error(w, "not allowed", http.StatusUnauthorized)
return
}
+ w.Header().Set("Content-Type", "text/html; charset=utf-8")
RenderEvents(w, req, sensitive)
})
}
@@ -172,7 +174,7 @@
completedMu.RLock()
data.Families = make([]string, 0, len(completedTraces))
- for fam, _ := range completedTraces {
+ for fam := range completedTraces {
data.Families = append(data.Families, fam)
}
completedMu.RUnlock()