From 2dbd2caaa9ab5b176b42bf1a934a1a536c38bb69 Mon Sep 17 00:00:00 2001 From: xjasonlyu Date: Mon, 3 Apr 2023 19:59:37 +0800 Subject: [PATCH] Fix: netstats JSON response --- restapi/netstats.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/restapi/netstats.go b/restapi/netstats.go index e311ee4..e62d9bf 100644 --- a/restapi/netstats.go +++ b/restapi/netstats.go @@ -38,7 +38,10 @@ func getNetStats(w http.ResponseWriter, r *http.Request) { } if !websocket.IsWebSocketUpgrade(r) { - render.JSON(w, r, snapshot()) + w.Header().Set("Content-Type", "application/json") + render.Status(r, http.StatusOK) + w.Write(snapshot()) + w.(http.Flusher).Flush() return }