diff --git a/main.go b/main.go index 177b4ed..16d0efd 100644 --- a/main.go +++ b/main.go @@ -30,10 +30,10 @@ type SlackConfig struct { // PostHandler send notifications from synology to slack func PostHandler(w http.ResponseWriter, r *http.Request) { + var api_key = r.Header.Get("api_key") if r.Header.Get("api_key") != appConfig.APIKey { http.Error(w, "invalid api key", http.StatusUnauthorized) log.Printf("invalid api key") - api_key = r.Header.Get("api_key") log.Printf("Received key: ", api_key) return }