Skip to content

Commit

Permalink
fix json unmarshal error when list plguins
Browse files Browse the repository at this point in the history
  • Loading branch information
caozhiyuan committed Feb 25, 2022
1 parent e2475cf commit b4a1255
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/apisix/cluster.go
Expand Up @@ -750,10 +750,14 @@ func (c *cluster) getList(ctx context.Context, url, resource string) ([]string,
return nil, err
}

var listResponse []string
var listResponse map[string]interface{}
dec := json.NewDecoder(resp.Body)
if err := dec.Decode(&listResponse); err != nil {
return nil, err
}
return listResponse, nil
var res []string = make([]string, len(listResponse))
for name := range listResponse {
res = append(res, name)
}
return res, nil
}

0 comments on commit b4a1255

Please sign in to comment.