From df0b1bcd6b09a8e40e4b5fa7c50233f5b30b4dc4 Mon Sep 17 00:00:00 2001
From: Massimiliano Adamo <maxadamo@gmail.com>
Date: Thu, 1 Sep 2022 14:19:19 +0200
Subject: [PATCH] add comment

---
 main.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go
index daf227a..1056df0 100644
--- a/main.go
+++ b/main.go
@@ -69,6 +69,7 @@ func renderPage(w http.ResponseWriter, req *http.Request) {
 
 // trigger puppet
 func triggerPuppet(w http.ResponseWriter, req *http.Request) {
+	// content-type is currently not working
 	cmd := exec.Command("/usr/bin/pkill", "-f", "/opt/puppetlabs/puppet/bin/puppet", "--signal", "SIGUSR1")
 	authToken := "BOFH"
 	_, ok := req.Header["Authorization"]
@@ -79,8 +80,7 @@ func triggerPuppet(w http.ResponseWriter, req *http.Request) {
 	unauthorizedMsg := fmt.Sprintln("{\n    \"status\": \"Unauthorized\",\n    \"response\": 401\n}")
 	unavailableMsg := fmt.Sprintln("{\n    \"status\": \"KO\",\n    \"response\": 503\n}")
 
-	req.Header.Add("Content-Type", "application/json")
-	//w.Header().Set("Content-Type", "application/json")
+	w.Header().Set("Content-Type", "application/json; charset=utf-8")
 	if authToken != bearerToken {
 		http.Error(w, unauthorizedMsg, http.StatusUnauthorized)
 	} else {
-- 
GitLab