fix(alerting): Omit empty KeyValue parameters when marshalling to JSON

This commit is contained in:
TwiN
2022-11-09 18:31:01 -05:00
parent 0ebd6c7a67
commit f1711b5c0b
2 changed files with 8 additions and 10 deletions

View File

@ -89,11 +89,11 @@ type Widgets struct {
}
type KeyValue struct {
TopLabel string `json:"topLabel"`
Content string `json:"content"`
ContentMultiline string `json:"contentMultiline"`
BottomLabel string `json:"bottomLabel"`
Icon string `json:"icon"`
TopLabel string `json:"topLabel,omitempty"`
Content string `json:"content,omitempty"`
ContentMultiline string `json:"contentMultiline,omitempty"`
BottomLabel string `json:"bottomLabel,omitempty"`
Icon string `json:"icon,omitempty"`
}
type Buttons struct {
@ -164,7 +164,7 @@ func (provider *AlertProvider) buildRequestBody(endpoint *core.Endpoint, alert *
Buttons: []Buttons{
{
TextButton: TextButton{
Text: "Open",
Text: "URL",
OnClick: OnClick{OpenLink: OpenLink{URL: endpoint.URL}},
},
},