Catch error on command execution with include-command-output-in-response=false
This commit is contained in:
parent
8c96ffd5f9
commit
7d10bd8bbc
@ -277,18 +277,17 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Header().Set(responseHeader.Name, responseHeader.Value)
|
w.Header().Set(responseHeader.Name, responseHeader.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
if matchedHook.CaptureCommandOutput {
|
|
||||||
response, err := handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
response, err := handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
fmt.Fprintf(w, "Error occurred while executing the hook's command. Please check your logs for more details.")
|
fmt.Fprintf(w, "Error occurred while executing the hook's command. Please check your logs for more details.")
|
||||||
} else {
|
return
|
||||||
fmt.Fprintf(w, response)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matchedHook.CaptureCommandOutput {
|
||||||
|
fmt.Fprintf(w, response)
|
||||||
} else {
|
} else {
|
||||||
go handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
|
||||||
fmt.Fprintf(w, matchedHook.ResponseMessage)
|
fmt.Fprintf(w, matchedHook.ResponseMessage)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user