Skip to content

Commit

Permalink
Merge pull request #682 from favonia/zero-pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz authored Aug 1, 2021
2 parents 6b46a9f + d937165 commit 8b318bc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cloudflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,12 @@ func WithZoneFilters(zoneName, accountID, status string) ReqOption {
// WithPagination configures the pagination for a response.
func WithPagination(opts PaginationOptions) ReqOption {
return func(opt *reqOption) {
opt.params.Set("page", strconv.Itoa(opts.Page))
opt.params.Set("per_page", strconv.Itoa(opts.PerPage))
if opts.Page > 0 {
opt.params.Set("page", strconv.Itoa(opts.Page))
}

if opts.PerPage > 0 {
opt.params.Set("per_page", strconv.Itoa(opts.PerPage))
}
}
}

0 comments on commit 8b318bc

Please sign in to comment.