mirror of
https://github.com/adnanh/webhook.git
synced 2025-10-04 21:51:02 +00:00
Rename context-provider-command
to pre-hook-command
and refactor the code to be more readable.
This commit is contained in:
parent
3ec7da2b15
commit
54cfc6bcbd
2 changed files with 52 additions and 55 deletions
16
hook/hook.go
16
hook/hook.go
|
@ -14,7 +14,9 @@ import (
|
|||
"log"
|
||||
"math"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
@ -423,11 +425,23 @@ func (h *HooksFiles) Set(value string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// PreHookContext is a structure consisted of request context data that will be passed to the pre-hook command
|
||||
type PreHookContext struct {
|
||||
HookID string `json:"hookID"`
|
||||
Method string `json:"method"`
|
||||
Base64EncodedBody string `json:"base64EncodedBody"`
|
||||
RemoteAddress string `json:"remoteAddress"`
|
||||
URI string `json:"URI"`
|
||||
Host string `json:"host"`
|
||||
Headers http.Header `json:"headers"`
|
||||
Query url.Values `json:"query"`
|
||||
}
|
||||
|
||||
// Hook type is a structure containing details for a single hook
|
||||
type Hook struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
ExecuteCommand string `json:"execute-command,omitempty"`
|
||||
ContextProviderCommand string `json:"context-provider-command,omitempty"`
|
||||
PreHookCommand string `json:"pre-hook-command,omitempty"`
|
||||
CommandWorkingDirectory string `json:"command-working-directory,omitempty"`
|
||||
ResponseMessage string `json:"response-message,omitempty"`
|
||||
ResponseHeaders ResponseHeaders `json:"response-headers,omitempty"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue