Skip to content
Myr

Add support for custom HTML and XML content-type

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Manu Mtz-Almeida · committed by Manu Mtz-Almeida · parent a7c957a · Browse files · 2 files+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+2 added−2 removed

  • other:+2 added−2 removed

2 files+2 added−2 removed

modified:render/html.go+1 added-1 removed
56 unmodified lines
57 panic("the HTML debug render was created without files or glob pattern")58}5960func (r HTML) Render(w http.ResponseWriter) error {61 w.Header()["Content-Type"] = htmlContentType61 writeContentType(w, htmlContentType)62 if len(r.Name) == 0 {63 return r.Template.Execute(w, r.Data)64 } else {65 return r.Template.ExecuteTemplate(w, r.Name, r.Data)
2 unmodified lines
modified:render/xml.go+1 added-1 removed
14 unmodified lines
1516var xmlContentType = []string{"application/xml; charset=utf-8"}1718func (r XML) Render(w http.ResponseWriter) error {19 w.Header()["Content-Type"] = xmlContentType19 writeContentType(w, xmlContentType)20 return xml.NewEncoder(w).Encode(r.Data)21}