cloudapi: Fix listing composes with empty result
It was returning a null body instead of an empty list. Related: RHEL-60120
This commit is contained in:
parent
b33f86783f
commit
12dd0b0be4
2 changed files with 5 additions and 1 deletions
|
|
@ -313,7 +313,7 @@ func (h *apiHandlers) GetComposeList(ctx echo.Context) error {
|
|||
}
|
||||
|
||||
// Gather up the details of each job
|
||||
var stats []ComposeStatus
|
||||
stats := []ComposeStatus{}
|
||||
for _, jid := range jobs {
|
||||
s, err := h.getJobIDComposeStatus(jid)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1887,6 +1887,10 @@ func TestComposesRoute(t *testing.T) {
|
|||
srv, _, _, cancel := newV2Server(t, t.TempDir(), false, false)
|
||||
defer cancel()
|
||||
|
||||
// List empty root composes
|
||||
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "GET", "/api/image-builder-composer/v2/composes/", ``,
|
||||
http.StatusOK, `[]`)
|
||||
|
||||
// Make a compose so it has something to list
|
||||
reply := test.TestRouteWithReply(t, srv.Handler("/api/image-builder-composer/v2"), false, "POST", "/api/image-builder-composer/v2/compose", fmt.Sprintf(`
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue