mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-31 09:42:28 +00:00
Add Request object to hook package to simplify API
To avoid having to pass around so many parameters to the hook package, create a Request object to store all request-specific data. Update APIs accordingly.
This commit is contained in:
parent
b8498c564d
commit
c6603894c1
4 changed files with 269 additions and 183 deletions
|
@ -53,7 +53,11 @@ func TestStaticParams(t *testing.T) {
|
|||
b := &bytes.Buffer{}
|
||||
log.SetOutput(b)
|
||||
|
||||
_, err = handleHook(spHook, "test", &spHeaders, &map[string]interface{}{}, &map[string]interface{}{}, &[]byte{})
|
||||
r := &hook.Request{
|
||||
ID: "test",
|
||||
Headers: spHeaders,
|
||||
}
|
||||
_, err = handleHook(spHook, r)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v\n", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue