This commit removes logging from the hook package and relies on returning errors
to convey...errors. Encountered errors are returned immediately. This commit
may alter the behavior of hook. If errors were logged in the past but the given
function did not return immediately, this commit would change that behavior.
Uses named errors and custom error types. You may be able to
consolidate ArgumentError and SourceError, but I need to think about it
some more. These changes should be transparent to the caller if they're
expecting standard "error" types.
Tests have been updated to validate error return values and provide test
coverage for a few new lines of code introduced by this commit.
It seems that signals code for Linux and OS X (FreeBSD) are different. I
rely on `syscall.SIGUSR1` which should be cross-compatible.
Tested with `kill -usr1 <pid>` on OS X 10.10
The payload couldn't be parsed when charset was present in the
`Content-Type` header. The content type should begin with the MIME type
so we now check if the content type starts with `application/json` or
`application/x-www-form-urlencoded`.
This closes#20
This commit removes the "helpers" package by moving functions from the
package into the other packages that use them.
CheckPayloadSignature() and ExtractParamater() are simply moved to the
"hook" package. I'm not sure of the usefulness of having these
functions exported, but I left them allow for now.
ValuesToMap() is moved to the "main" webhook package and renamed to
valuesToMap().
Tests were moved into the "hook" package since we only test
ExtractParameter() right now.
This commit closesadnanh/webhook#12.