Correct compat network prune response

Correcting the structure of the compat network prune response.  They
should follow {"NetworksDeleted": [<network_name>",...]}

Fixes: #9310

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2021-02-10 15:48:14 -06:00
parent 4d604c1089
commit f28b08fe96
2 changed files with 12 additions and 1 deletions

View File

@ -400,6 +400,9 @@ func Prune(w http.ResponseWriter, r *http.Request) {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err)
return
}
type response struct {
NetworksDeleted []string
}
var prunedNetworks []string //nolint
for _, pr := range pruneReports {
if pr.Error != nil {
@ -408,5 +411,5 @@ func Prune(w http.ResponseWriter, r *http.Request) {
}
prunedNetworks = append(prunedNetworks, pr.Name)
}
utils.WriteResponse(w, http.StatusOK, prunedNetworks)
utils.WriteResponse(w, http.StatusOK, response{NetworksDeleted: prunedNetworks})
}