From 2dc31bee2011afafeec77a49d11817b8df6303f9 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 21 Oct 2019 17:50:44 +0300 Subject: [PATCH 1/2] * /control/stats: set Content-Type: application/json --- stats/stats_http.go | 1 + 1 file changed, 1 insertion(+) diff --git a/stats/stats_http.go b/stats/stats_http.go index e857ecc3..a507b32c 100644 --- a/stats/stats_http.go +++ b/stats/stats_http.go @@ -41,6 +41,7 @@ func (s *statsCtx) handleStats(w http.ResponseWriter, r *http.Request) { return } + w.Header().Set("Content-Type", "application/json") w.Write(data) } From 8985faa95d5414393165097fde032c02ff560b32 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 21 Oct 2019 17:50:46 +0300 Subject: [PATCH 2/2] * minor --- stats/stats_http.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/stats/stats_http.go b/stats/stats_http.go index a507b32c..4d860fee 100644 --- a/stats/stats_http.go +++ b/stats/stats_http.go @@ -95,16 +95,8 @@ func (s *statsCtx) initWeb() { return } - s.conf.HTTPRegister("GET", "/control/stats", func(w http.ResponseWriter, r *http.Request) { - s.handleStats(w, r) - }) - s.conf.HTTPRegister("POST", "/control/stats_reset", func(w http.ResponseWriter, r *http.Request) { - s.handleStatsReset(w, r) - }) - s.conf.HTTPRegister("POST", "/control/stats_config", func(w http.ResponseWriter, r *http.Request) { - s.handleStatsConfig(w, r) - }) - s.conf.HTTPRegister("GET", "/control/stats_info", func(w http.ResponseWriter, r *http.Request) { - s.handleStatsInfo(w, r) - }) + s.conf.HTTPRegister("GET", "/control/stats", s.handleStats) + s.conf.HTTPRegister("POST", "/control/stats_reset", s.handleStatsReset) + s.conf.HTTPRegister("POST", "/control/stats_config", s.handleStatsConfig) + s.conf.HTTPRegister("GET", "/control/stats_info", s.handleStatsInfo) }