Using Render() instead of Write()
This commit is contained in:
+2
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user