From b8075a7d96a24da438c5eb4c2b01a2046a8fb20a Mon Sep 17 00:00:00 2001 From: Odyssey346 Date: Wed, 3 Aug 2022 21:43:20 +0200 Subject: [PATCH] fix superfluous response.WriteHeader() Signed-off-by: Odyssey346 --- api/announcements.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/announcements.go b/api/announcements.go index abafc49..f0931b9 100644 --- a/api/announcements.go +++ b/api/announcements.go @@ -77,7 +77,6 @@ func handleAnnouncementDeleteRequest(w http.ResponseWriter, r *http.Request) { http.Error(w, "You need to provide the authorization token given to you by your system administrator in order to delete an announcement.", http.StatusUnauthorized) return } else { - w.WriteHeader(http.StatusOK) if _, err := os.Stat("./static/announcements.json"); errors.Is(err, os.ErrNotExist) { http.Error(w, "If you're gonna delete the annoucement, there has to be an announcement in the first place.", http.StatusNotFound) return @@ -87,6 +86,7 @@ func handleAnnouncementDeleteRequest(w http.ResponseWriter, r *http.Request) { log.Fatal(err) } w.Write([]byte("Announcement deleted!")) + w.WriteHeader(http.StatusOK) return } }