Add support for custom HTML and XML content-type
This commit is contained in:
parent
a7c957af7d
commit
352868ef90
@ -58,7 +58,7 @@ func (r HTMLDebug) loadTemplate() *template.Template {
|
||||
}
|
||||
|
||||
func (r HTML) Render(w http.ResponseWriter) error {
|
||||
w.Header()["Content-Type"] = htmlContentType
|
||||
writeContentType(w, htmlContentType)
|
||||
if len(r.Name) == 0 {
|
||||
return r.Template.Execute(w, r.Data)
|
||||
} else {
|
||||
|
@ -16,6 +16,6 @@ type XML struct {
|
||||
var xmlContentType = []string{"application/xml; charset=utf-8"}
|
||||
|
||||
func (r XML) Render(w http.ResponseWriter) error {
|
||||
w.Header()["Content-Type"] = xmlContentType
|
||||
writeContentType(w, xmlContentType)
|
||||
return xml.NewEncoder(w).Encode(r.Data)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user