fix(api): fix empty response for alertList.json

This commit is contained in:
Łukasz Mierzwa
2021-07-08 09:57:57 +01:00
committed by Łukasz Mierzwa
parent 8c2f1d8a6f
commit e1505a01cb
2 changed files with 9 additions and 1 deletions

View File

@@ -729,7 +729,9 @@ func alertList(w http.ResponseWriter, r *http.Request) {
}
sort.Strings(sortKeys)
al := AlertList{}
al := AlertList{
Alerts: []map[string]string{},
}
for _, labels := range labelMap {
al.Alerts = append(al.Alerts, labels)
}

View File

@@ -3165,6 +3165,12 @@ func TestAlertList(t *testing.T) {
},
},
},
{
args: "q=foo=bar",
alerts: AlertList{
Alerts: []map[string]string{},
},
},
}
mockConfig()