From f0438ff8225a61ea52aa000ba70722c0ebc09239 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 2 Oct 2023 02:35:01 +0400 Subject: [PATCH] In ListenersGet() text/plain was replaced by application/json. --- internal/http/dj_handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/http/dj_handlers.go b/internal/http/dj_handlers.go index 6def03b..ea8a743 100644 --- a/internal/http/dj_handlers.go +++ b/internal/http/dj_handlers.go @@ -23,8 +23,8 @@ func NewDJHandlers(l *radio.ListenerCounter, p *radio.Playlist, slLen int) *DJHa } func (dj *DJHandlers) ListenersGet(w http.ResponseWriter, _ *http.Request) { - w.Header().Add("Content-Type", "text/plain") - fmt.Fprint(w, dj.listeners.Current(), dj.listeners.Peak()) + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(dj.listeners) } func (dj *DJHandlers) ListenersInc(w http.ResponseWriter, _ *http.Request) {