diff --git a/main.go b/main.go index d0d1dd053cec5c655b5846eaa93e1a77b77a38c4..2d41f277977fc11731201f1bc3068110474f2e94 100644 --- a/main.go +++ b/main.go @@ -86,16 +86,18 @@ func triggerPuppet(w http.ResponseWriter, req *http.Request) { writeFile(fmt.Sprintf("{\n \"status\": \"KO\",\n \"response\": 401\n \"token\": %v\n}", authToken), "/tmp/503.json") if authToken != bearerToken { statusFile = "/tmp/401.json" - w.WriteHeader(http.StatusUnauthorized) - http.ServeFile(w, req, statusFile) + //w.WriteHeader(http.StatusUnauthorized) + http.Error(w, "unauthorized access", http.StatusUnauthorized) + http.ServeFile(w, req, "/tmp/401.json") + //http.ServeFile(w, req, statusFile) } else { cmd.Run() if verboseBool { InfoLogger.Printf("HTTP Status %v", http.StatusOK) } w.Header().Set("Content-Type", "application/json") + http.ServeFile(w, req, statusFile) } - http.ServeFile(w, req, statusFile) } // function redirect