Skip to content

Commit

Permalink
Pass empty pointer to json.Unmarshal when chunking (#2977)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Plourde <simon@sensu.io>
  • Loading branch information
Simon Plourde authored and ccressent committed May 21, 2019
1 parent c589847 commit d94ea66
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cli/client/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ func (client *RestClient) List(path string, objs interface{}, options *ListOptio
panic("unexpected type for objs")
}

newObjs := reflect.New(objsType.Elem())

for {
request := client.R()
ApplyListOptions(request, options)
Expand All @@ -61,6 +59,7 @@ func (client *RestClient) List(path string, objs interface{}, options *ListOptio
return UnmarshalError(resp)
}

newObjs := reflect.New(objsType.Elem())
if err := json.Unmarshal(resp.Body(), newObjs.Interface()); err != nil {
return err
}
Expand Down

0 comments on commit d94ea66

Please sign in to comment.