-
Notifications
You must be signed in to change notification settings - Fork 13
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
Remove WebhookConfig.Headers in favour of WebhookConfig.HTTP.HTTPHeaders #122
Remove WebhookConfig.Headers in favour of WebhookConfig.HTTP.HTTPHeaders #122
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #122 +/- ##
=======================================
Coverage 99.98% 99.98%
=======================================
Files 78 78
Lines 6437 6439 +2
=======================================
+ Hits 6436 6438 +2
Misses 1 1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Chris Bygrave <chris.bygrave@kaleido.io>
1422330
to
0233847
Compare
@@ -34,7 +34,6 @@ import ( | |||
type WebhookConfig struct { | |||
URL *string `ffstruct:"whconfig" json:"url,omitempty"` | |||
Method *string `ffstruct:"whconfig" json:"method,omitempty"` | |||
Headers map[string]string `ffstruct:"whconfig" json:"headers,omitempty"` |
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.
This would have to feed its way into a release note as it's a breaking change, I wonder if we want a deprecated field instead?
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.
I suggest at the stage of lifeycle we're at with this function we're ok with the release notes item.
I can include that cutting a release on the common library.
pkg/eventstreams/webhooks.go
Outdated
if w.spec.HTTP != nil { | ||
for h, v := range w.spec.HTTP.HTTPHeaders { | ||
if vs, ok := v.(string); ok { | ||
req.Header.Set(h, vs) | ||
} | ||
} |
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.
I think we just remove this. They get added as part of the init of the HTTP Config so this will result in double work.
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.
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.
Good point - thanks
Signed-off-by: Chris Bygrave <chris.bygrave@kaleido.io>
WebhookConfig was recently introduced with a top-level
headers
property. However it also contains anhttp
property - a standardffrestry.HTTPConfig
object which already provides the facility for defining HTTP headers.This PR removes the top-level
headers
property, and updates the web hook action to useHTTP.HTTPHeaders
on the request instead.