From 1e22b980abae96b40428a67f2dc4a12df1156a3d Mon Sep 17 00:00:00 2001
From: "kali kaneko (leap communications)" <kali@leap.se>
Date: Tue, 16 Feb 2021 20:32:21 +0100
Subject: [PATCH] [bug] write headers before sending response

- Closes: #436
---
 pkg/helper/helper.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkg/helper/helper.go b/pkg/helper/helper.go
index 691fc6e1..006d23b1 100644
--- a/pkg/helper/helper.go
+++ b/pkg/helper/helper.go
@@ -148,17 +148,17 @@ func firewallStopHandler(w http.ResponseWriter, r *http.Request) {
 
 func firewallIsUpHandler(w http.ResponseWriter, r *http.Request) {
 	if firewallIsUp() {
-		w.Write([]byte("true"))
 		w.WriteHeader(http.StatusOK)
+		w.Write([]byte("true"))
 	} else {
-		w.Write([]byte("false"))
 		w.WriteHeader(http.StatusNoContent)
+		w.Write([]byte("false"))
 	}
 }
 
 func versionHandler(w http.ResponseWriter, r *http.Request) {
-	w.Write([]byte(AppName + "/" + Version + "\n"))
 	w.WriteHeader(http.StatusOK)
+	w.Write([]byte(AppName + "/" + Version + "\n"))
 }
 
 func getArgs(r *http.Request) ([]string, error) {
-- 
GitLab