diff --git a/internal/http/dj_handlers.go b/internal/http/dj_handlers.go index 8f8e67c..90c0791 100644 --- a/internal/http/dj_handlers.go +++ b/internal/http/dj_handlers.go @@ -36,7 +36,7 @@ func (dj *DJHandlers) ListenersUpdateIcecast(w http.ResponseWriter, r *http.Requ if err := r.ParseForm(); err != nil { log.Println("DJHandlers.ListenersUpdateIcecast:", err) - http.Error(w, "cannot parse form", http.StatusBadRequest) + w.WriteHeader(http.StatusBadRequest) return } @@ -46,7 +46,7 @@ func (dj *DJHandlers) ListenersUpdateIcecast(w http.ResponseWriter, r *http.Requ case "listener_remove": if _, err := dj.listeners.Dec(); err != nil { log.Println("DJHandlers.ListenersUpdateIcecast:", err) - http.Error(w, err.Error(), http.StatusBadRequest) + w.WriteHeader(http.StatusBadRequest) return } default: @@ -70,7 +70,7 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) { log.Println("the end of a playlist has been reached") if nxt = dj.fallbackSong; nxt == "" { log.Println("a fallback song is not set") - http.Error(w, "a playlist is empty and a fallback song is not set", http.StatusNotFound) + w.WriteHeader(http.StatusNotFound) return } } @@ -78,7 +78,7 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) { oggf, err := oggtag.NewOggFile(nxt) if err != nil { log.Println("cannot read an OGG file", nxt, ":", err) - http.Error(w, "cannot read an OGG file", http.StatusInternalServerError) + w.WriteHeader(http.StatusInternalServerError) return }