mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-23 22:02:28 +00:00
Fix environment and argument passing
Two issues are addressed in this commit: 1. Instead of only sending the predefined environment arguments, this commit appends the arguments to the existing OS environment. Fixes #53. 2. If an argument is not found in the payload, allow the command to run and pass in an empty string as a placeholder. Fixes #54. Additionally, I replaced `hook.ErrInvalidPayloadSignature` with a new `SignatureError` type so that we can embed the signature in the error.
This commit is contained in:
parent
a7aa7f2327
commit
d2e315d9c6
5 changed files with 97 additions and 17 deletions
|
@ -123,7 +123,7 @@ var hookExtractCommandArgumentsTests = []struct {
|
|||
}{
|
||||
{"test", []Argument{Argument{"header", "a"}}, &map[string]interface{}{"a": "z"}, nil, nil, []string{"test", "z"}, true},
|
||||
// failures
|
||||
{"fail", []Argument{Argument{"payload", "a"}}, &map[string]interface{}{"a": "z"}, nil, nil, []string{"fail"}, false},
|
||||
{"fail", []Argument{Argument{"payload", "a"}}, &map[string]interface{}{"a": "z"}, nil, nil, []string{"fail", ""}, false},
|
||||
}
|
||||
|
||||
func TestHookExtractCommandArguments(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue