refactor: support AbortWithStatusJSON (#200)

This commit is contained in:
Bo-Yi Wu
2017-03-29 09:21:31 +08:00
committed by GitHub
parent d94c9437f5
commit 5b2b3695e5
67 changed files with 55188 additions and 128 deletions

View File

@@ -58,9 +58,14 @@ func (r HTMLDebug) loadTemplate() *template.Template {
}
func (r HTML) Render(w http.ResponseWriter) error {
writeContentType(w, htmlContentType)
r.WriteContentType(w)
if len(r.Name) == 0 {
return r.Template.Execute(w, r.Data)
}
return r.Template.ExecuteTemplate(w, r.Name, r.Data)
}
func (r HTML) WriteContentType(w http.ResponseWriter) {
writeContentType(w, htmlContentType)
}