mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-22 21:32:32 +00:00
Add CaptureCommandOutputOnError
to include stdout & stderror in failed executions, with docs.
This commit is contained in:
parent
44d19e34a0
commit
a40fba5e29
3 changed files with 8 additions and 2 deletions
|
@ -282,9 +282,13 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
|
|||
response, err := handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
||||
|
||||
if err != nil {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
fmt.Fprintf(w, "Error occurred while executing the hook's command. Please check your logs for more details.")
|
||||
if matchedHook.CaptureCommandOutputOnError {
|
||||
fmt.Fprintf(w, response)
|
||||
} else {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
fmt.Fprintf(w, "Error occurred while executing the hook's command. Please check your logs for more details.")
|
||||
}
|
||||
} else {
|
||||
fmt.Fprintf(w, response)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue