-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add http webhook #5233
base: main
Are you sure you want to change the base?
feat: add http webhook #5233
Conversation
bbb3a44
to
d6774bf
Compare
Signed-off-by: Piotr Pawluk <piotr.pawluk@zendesk.com>
24cf799
to
9bd4c5d
Compare
Rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I left a few small comments but overall nice addition!
} | ||
|
||
// RoundTrip handles each http request. | ||
func (t *AuthedTransport) RoundTrip(req *http.Request) (*http.Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://pkg.go.dev/net/http#RoundTripper says
RoundTrip should not modify the request, except for consuming and closing the Request's Body
I'm not very familiar with the http package, so I'm not sure what the implications are if the request is modified (or if adding headers qualifies as "modifying"), any thoughts here?
As an alternative you could always pass the headers into the webhook itself then set them on doSend()
return nil | ||
} | ||
|
||
func (h *HttpWebhook) doSend(_ logging.SimpleLogging, applyResult ApplyResult) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since doSend()
is a non-exported method (i.e. unlike Send()
) you should be able to omit logging.SimpleLogging
altogether instead of passing it in and not using it.
(Though this does mean you'll have to make logging.SimpleLogging _
in Send()
)
what
Adding HTTP webhook implementation to send notifications to any HTTP(S) endpoint.
http
webhook kind--webhook-http-headers
optional parameter to pass any extra headers with the requestProjectName
to webhook payloadwhy
To send notifications to other systems than just Slack. Feature request: #810
tests
references