Adds supports for custom JSON Content-type

This commit is contained in:
Manu Mtz-Almeida
2015-06-13 04:29:10 +02:00
parent 22f118f3b6
commit a7c957af7d
4 changed files with 23 additions and 6 deletions
+2 -4
View File
@@ -23,10 +23,8 @@ func (r String) Render(w http.ResponseWriter) error {
}
func WriteString(w http.ResponseWriter, format string, data []interface{}) {
header := w.Header()
if _, exist := header["Content-Type"]; !exist {
header["Content-Type"] = plainContentType
}
writeContentType(w, plainContentType)
if len(data) > 0 {
fmt.Fprintf(w, format, data...)
} else {