diff --git a/main.go b/main.go index daf227af2961699439730dc83d771c61ca32aead..1056df0f9bd09f4a9fde1cf9497a91aab554c737 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 {