api-pagination
api-pagination copied to clipboard
Accept zero per page
HI David. I noticed that the per_page
param is converted to the default value when it is 0. I'd like my API's clients to be able to fetch merely the total number of objects (found in the X-Total header) w/o fetching any actual objects. This is easily implemented by accepting 0 as a valid per_page
value. Right now I'd have to monkey patch methods (i.e this one) to make that work. Would you consider allowing zero for the per_page
param? Maybe using a new config option if you don't want to break existing behavior.
I'm not sure how well supported this is by the underlying pagination libraries though, you might run into ZeroDivisionError's and such, which you'll then have to deal with.