diff --git a/handlers/infos.go b/handlers/infos.go index a26b72d..4062ebb 100644 --- a/handlers/infos.go +++ b/handlers/infos.go @@ -34,6 +34,7 @@ func getActiveIP() string { } func InfoHandler(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") port := env.Port.GetValue() if port == "" { port = "8080" @@ -49,5 +50,9 @@ func InfoHandler(w http.ResponseWriter, r *http.Request) { "port": port, "speed": GetInterval(), } - json.NewEncoder(w).Encode(data) + err := json.NewEncoder(w).Encode(data) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } }