mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-22 21:32:32 +00:00
separated windows and other platforms to different files, removed signal watcher from windows build file so webhook can actually compile on windows, added string as a source, so you can pass static strings to your scripts without having to wrap them around with other scripts
This commit is contained in:
parent
6053f48b23
commit
4350685330
4 changed files with 271 additions and 2 deletions
|
@ -19,6 +19,7 @@ const (
|
|||
SourceHeader string = "header"
|
||||
SourceQuery string = "url"
|
||||
SourcePayload string = "payload"
|
||||
SourceString string = "string"
|
||||
)
|
||||
|
||||
// CheckPayloadSignature calculates and verifies SHA1 signature of the given payload
|
||||
|
@ -148,6 +149,8 @@ func (ha *Argument) Get(headers, query, payload *map[string]interface{}) (string
|
|||
source = query
|
||||
case SourcePayload:
|
||||
source = payload
|
||||
case SourceString:
|
||||
return ha.Name, true
|
||||
}
|
||||
|
||||
if source != nil {
|
||||
|
@ -194,7 +197,11 @@ func (h *Hook) ParseJSONParameters(headers, query, payload *map[string]interface
|
|||
source = query
|
||||
}
|
||||
|
||||
ReplaceParameter(h.JSONStringParameters[i].Name, source, newArg)
|
||||
if source != nil {
|
||||
ReplaceParameter(h.JSONStringParameters[i].Name, source, newArg)
|
||||
} else {
|
||||
log.Printf("invalid source for argument %+v\n", h.JSONStringParameters[i])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.Printf("couldn't retrieve argument for %+v\n", h.JSONStringParameters[i])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue