Fast path for setting headers.
- No heap allocation - No indirection - CanonicalMIMEHeaderKey() is not called
This commit is contained in:
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user