From f83af9713834a3b49f03f130aa9ed892b10972fd Mon Sep 17 00:00:00 2001 From: Adnan Hajdarevic Date: Tue, 17 Mar 2015 19:34:54 +0100 Subject: [PATCH] added per-hook defined response message --- hook/hook.go | 1 + webhook.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hook/hook.go b/hook/hook.go index 576d0e5..d0c4141 100644 --- a/hook/hook.go +++ b/hook/hook.go @@ -49,6 +49,7 @@ type Hook struct { ID string `json:"id"` ExecuteCommand string `json:"execute-command"` CommandWorkingDirectory string `json:"command-working-directory"` + ResponseMessage string `json:"response-message"` PassArgumentsToCommand []Argument `json:"pass-arguments-to-command"` TriggerRule *Rules `json:"trigger-rule"` } diff --git a/webhook.go b/webhook.go index e6113af..0b445a9 100644 --- a/webhook.go +++ b/webhook.go @@ -22,7 +22,7 @@ import ( ) const ( - version = "2.2.1" + version = "2.2.2" ) var ( @@ -175,9 +175,10 @@ func hookHandler(w http.ResponseWriter, r *http.Request) { // handle hook go handleHook(hook, &headers, &query, &payload, &body) - // say thanks - fmt.Fprintf(w, "Thanks.") + // send the hook defined response message + fmt.Fprintf(w, hook.ResponseMessage) } else { + w.WriteHeader(http.StatusNotFound) fmt.Fprintf(w, "Hook not found.") } }