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:
Cameron Moore 2020-09-25 19:46:06 -05:00
parent b8498c564d
commit c6603894c1
4 changed files with 269 additions and 183 deletions

View file

@ -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)
}