-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"` | ||
TLSConfigName *string `ffstruct:"whconfig" json:"tlsConfigName,omitempty"` | ||
HTTP *ffresty.HTTPConfig `ffstruct:"whconfig" json:"http,omitempty"` | ||
validated bool | ||
|
@@ -115,8 +114,13 @@ func (w *webhookAction[CT, DT]) AttemptDispatch(ctx context.Context, attempt int | |
SetResult(&resBody). | ||
SetError(&resBody) | ||
req.Header.Set("Content-Type", "application/json") | ||
for h, v := range w.spec.Headers { | ||
req.Header.Set(h, v) | ||
|
||
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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Good point - thanks |
||
} | ||
res, err := req.Execute(method, u.String()) | ||
if err != nil { | ||
|
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.