From 6076fd9a69e75712a5f52cede06f5e76628acbbc Mon Sep 17 00:00:00 2001 From: xjasonlyu Date: Thu, 21 Apr 2022 23:30:54 +0800 Subject: [PATCH] Chore(netstats): just render.JSON --- restapi/netstats.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/restapi/netstats.go b/restapi/netstats.go index e554cbc..e311ee4 100644 --- a/restapi/netstats.go +++ b/restapi/netstats.go @@ -38,11 +38,7 @@ func getNetStats(w http.ResponseWriter, r *http.Request) { } if !websocket.IsWebSocketUpgrade(r) { - w.Header().Set("Content-Type", "application/json") - render.Status(r, http.StatusOK) - // write and flush. - w.Write(snapshot()) - w.(http.Flusher).Flush() + render.JSON(w, r, snapshot()) return }