Chore(netstats): just render.JSON

This commit is contained in:
xjasonlyu
2022-04-21 23:30:54 +08:00
parent 3926f86613
commit 6076fd9a69

View File

@@ -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
}