Fast path for setting headers.

- No heap allocation
- No indirection
- CanonicalMIMEHeaderKey() is not called
This commit is contained in:
Manu Mtz-Almeida
2015-05-23 16:39:25 +02:00
parent 35fd7fb480
commit a2105ce34c
4 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ type (
}
)
const htmlContentType = "text/html; charset=utf-8"
var htmlContentType = []string{"text/html; charset=utf-8"}
func (r HTMLProduction) Instance(name string, data interface{}) Render {
return HTML{
@@ -58,6 +58,6 @@ func (r HTMLDebug) loadTemplate() *template.Template {
}
func (r HTML) Write(w http.ResponseWriter) error {
w.Header().Set("Content-Type", htmlContentType)
w.Header()["Content-Type"] = htmlContentType
return r.Template.ExecuteTemplate(w, r.Name, r.Data)
}