Skip to content

Commit

Permalink
fix /libpod/pods/json returns null when there are no pods
Browse files Browse the repository at this point in the history
Signed-off-by: zhangguanzhang <[email protected]>
  • Loading branch information
zhangguanzhang committed Aug 21, 2020
1 parent 516196f commit fb4977b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/api/handlers/utils/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport
}

if len(pods) == 0 {
return nil, nil
return []*entities.ListPodsReport{}, nil
}

lps := make([]*entities.ListPodsReport, 0, len(pods))
Expand Down
2 changes: 1 addition & 1 deletion test/apiv2/40-pods.at
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# test pod-related endpoints
#

t GET "libpod/pods/json (clean slate at start)" 200 null
t GET "libpod/pods/json (clean slate at start)" 200 '[]'

t POST libpod/pods/create name=foo 201 .Id~[0-9a-f]\\{64\\}
pod_id=$(jq -r .Id <<<"$output")
Expand Down

0 comments on commit fb4977b

Please sign in to comment.