Skip to content
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

Merged

Conversation

chrisbygrave
Copy link
Contributor

WebhookConfig was recently introduced with a top-level headers property. However it also contains an http property - a standard ffrestry.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 use HTTP.HTTPHeaders on the request instead.

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5b53a57) 99.98% compared to head (0233847) 99.98%.

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.
📢 Have feedback on the report? Share it here.

Signed-off-by: Chris Bygrave <chris.bygrave@kaleido.io>
@chrisbygrave chrisbygrave force-pushed the simplify-webhook-headers branch from 1422330 to 0233847 Compare January 24, 2024 11:05
@@ -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"`
Copy link
Contributor

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?

Copy link
Contributor

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.

Comment on lines 118 to 123
if w.spec.HTTP != nil {
for h, v := range w.spec.HTTP.HTTPHeaders {
if vs, ok := v.(string); ok {
req.Header.Set(h, vs)
}
}
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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>
@peterbroadhurst peterbroadhurst merged commit badf065 into hyperledger:main Jan 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants