Skip to content

Include correct limits in LimitOffsetPagination link urls #3015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

strixcuriosus
Copy link
Contributor

For LimitOffsetPagination, if the limit from the query param is invalid or greater than the max_limit, then the previous and next links should contain the actual limit being used instead of the originally requested limit.

Examples:

  • with a default_limit set, a request to http://testserver/?limit=hello
# instead of keeping the invalid limit in the url
url = 'http://testserver/?limit=hello&offset{0}'.format(default_limit)
# should provide a next link with the default_limit in the url
url = 'http://testserver/?limit={0}&offset={1}'.format(default_limit, default_limit)
  • similarly, with a max_limit set to 10, a request to http://testserver/?limit=100 should provide a next link with url http://testserver/?limit=10&offset=10 instead of http://testserver/?limit=100&offset=10

@tomchristie tomchristie modified the milestones: 3.1.3 Release, 3.1.4 Release Jun 5, 2015
@tomchristie
Copy link
Member

Yup, looks good. Nice catch.

tomchristie added a commit that referenced this pull request Jun 5, 2015
…ink-urls

Include correct limits in LimitOffsetPagination link urls
@tomchristie tomchristie merged commit 6651432 into encode:master Jun 5, 2015
@tomchristie tomchristie modified the milestones: 3.1.4 Release, 3.2.0 Release Jul 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants