mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-23 05:42:30 +00:00
Added SuccessHttpResponseCode handling for case when capture output is set to true.
This commit is contained in:
parent
22073d8847
commit
ef3f43f89f
1 changed files with 5 additions and 1 deletions
|
@ -293,12 +293,16 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
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 {
|
} else {
|
||||||
|
// Check if a success return code is configured for the hook
|
||||||
|
if matchedHook.SuccessHttpResponseCode != 0 {
|
||||||
|
writeHttpResponseCode(w, rid, matchedHook.ID, matchedHook.HttpResponseCode)
|
||||||
|
}
|
||||||
fmt.Fprintf(w, response)
|
fmt.Fprintf(w, response)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
go handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
go handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
||||||
|
|
||||||
// Check if a return code is configured for the hook
|
// Check if a success return code is configured for the hook
|
||||||
if matchedHook.SuccessHttpResponseCode != 0 {
|
if matchedHook.SuccessHttpResponseCode != 0 {
|
||||||
writeHttpResponseCode(w, rid, matchedHook.ID, matchedHook.SuccessHttpResponseCode)
|
writeHttpResponseCode(w, rid, matchedHook.ID, matchedHook.SuccessHttpResponseCode)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue