fix(alertmanager): send empty array instead of nil (#7312)

This commit is contained in:
Vibhu Pandey 2025-03-14 21:16:37 +05:30 committed by GitHub
parent de53119257
commit f96a234faa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,6 +97,11 @@ func (api *API) ListChannels(rw http.ResponseWriter, req *http.Request) {
return
}
// This ensures that the UI receives an empty array instead of null
if len(channels) == 0 {
channels = make([]*alertmanagertypes.Channel, 0)
}
render.Success(rw, http.StatusOK, channels)
}