mirror of
https://github.com/adnanh/webhook.git
synced 2026-07-26 17:19:17 +08:00
Added SuccessHttpResponseCode handling for case when capture output is set to true.
This commit is contained in:
+5
-1
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user