mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-10 15:44:43 +00:00
Renamed http-response-code to success-http-response-code
This commit is contained in:
parent
c05ca8c528
commit
22073d8847
3 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ Hooks are defined as JSON objects. Please note that in order to be considered va
|
|||
* `command-working-directory` - specifies the working directory that will be used for the script when it's executed
|
||||
* `response-message` - specifies the string that will be returned to the hook initiator
|
||||
* `response-headers` - specifies the list of headers in format `{"name": "X-Example-Header", "value": "it works"}` that will be returned in HTTP response for the hook
|
||||
* `http-response-code` - specifies the HTTP status code to be returned
|
||||
* `success-http-response-code` - specifies the HTTP status code to be returned upon success
|
||||
* `include-command-output-in-response` - boolean whether webhook should wait for the command to finish and return the raw output as a response to the hook initiator. If the command fails to execute or encounters any errors while executing the response will result in 500 Internal Server Error HTTP status code, otherwise the 200 OK status code will be returned.
|
||||
* `include-command-output-in-response-on-error` - boolean whether webhook should include command stdout & stderror as a response in failed executions. It only works if `include-command-output-in-response` is set to `true`.
|
||||
* `parse-parameters-as-json` - specifies the list of arguments that contain JSON strings. These parameters will be decoded by webhook and you can access them like regular objects in rules and `pass-arguments-to-command`.
|
||||
|
|
|
@ -427,7 +427,7 @@ type Hook struct {
|
|||
TriggerRule *Rules `json:"trigger-rule,omitempty"`
|
||||
TriggerRuleMismatchHttpResponseCode int `json:"trigger-rule-mismatch-http-response-code,omitempty"`
|
||||
IncomingPayloadContentType string `json:"incoming-payload-content-type,omitempty"`
|
||||
HttpResponseCode int `json:"http-response-code,omitempty"`
|
||||
SuccessHttpResponseCode int `json:"success-http-response-code,omitempty"`
|
||||
}
|
||||
|
||||
// ParseJSONParameters decodes specified arguments to JSON objects and replaces the
|
||||
|
|
|
@ -299,8 +299,8 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
|
|||
go handleHook(matchedHook, rid, &headers, &query, &payload, &body)
|
||||
|
||||
// Check if a return code is configured for the hook
|
||||
if matchedHook.HttpResponseCode != 0 {
|
||||
writeHttpResponseCode(w, rid, matchedHook.ID, matchedHook.HttpResponseCode)
|
||||
if matchedHook.SuccessHttpResponseCode != 0 {
|
||||
writeHttpResponseCode(w, rid, matchedHook.ID, matchedHook.SuccessHttpResponseCode)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, matchedHook.ResponseMessage)
|
||||
|
|
Loading…
Add table
Reference in a new issue