Skip to content

Commit

Permalink
Add support for custom HTML and XML content-type
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jun 13, 2015
1 parent a7c957a commit 352868e
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion render/html.go
Original file line number Diff line number Diff line change
@@ -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 {
2 changes: 1 addition & 1 deletion render/xml.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 352868e

Please sign in to comment.