Using Render() instead of Write()

This commit is contained in:
Manu Mtz-Almeida
2015-06-04 05:25:21 +02:00
parent 92475baba6
commit 1f56e50083
9 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -21,12 +21,12 @@ type (
var jsonContentType = []string{"application/json; charset=utf-8"}
func (r JSON) Write(w http.ResponseWriter) error {
func (r JSON) Render(w http.ResponseWriter) error {
w.Header()["Content-Type"] = jsonContentType
return json.NewEncoder(w).Encode(r.Data)
}
func (r IndentedJSON) Write(w http.ResponseWriter) error {
func (r IndentedJSON) Render(w http.ResponseWriter) error {
w.Header()["Content-Type"] = jsonContentType
jsonBytes, err := json.MarshalIndent(r.Data, "", " ")
if err != nil {