Skip to content

Commit

Permalink
fix(client): Avoid division by zero in pagination (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunet authored Mar 12, 2022
1 parent 7dc3dd0 commit 14975f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func (c *Client) doRequest(req *http.Request, emptyResponse bool) (interface{},
var values []interface{}
for {
values = append(values, responsePaginated.Values...)
if responsePaginated.Size/responsePaginated.Pagelen <= responsePaginated.Page {
if responsePaginated.Pagelen == 0 || responsePaginated.Size/responsePaginated.Pagelen <= responsePaginated.Page {
break
}
newReq, err := http.NewRequest(req.Method, responsePaginated.Next, nil)
Expand Down

0 comments on commit 14975f6

Please sign in to comment.