Skip to content
Snippets Groups Projects
Unverified Commit 0f13447d authored by Max Adamo's avatar Max Adamo
Browse files

test

parent da8b39ab
Branches
Tags
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment