Fast path for setting headers.
- No heap allocation - No indirection - CanonicalMIMEHeaderKey() is not called
This commit is contained in:
+2
-2
@@ -13,9 +13,9 @@ type XML struct {
|
||||
Data interface{}
|
||||
}
|
||||
|
||||
const xmlContentType = "application/xml; charset=utf-8"
|
||||
var xmlContentType = []string{"application/xml; charset=utf-8"}
|
||||
|
||||
func (r XML) Write(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", xmlContentType)
|
||||
w.Header()["Content-Type"] = xmlContentType
|
||||
return xml.NewEncoder(w).Encode(r.Data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user