Skip to content

LimitOffset pagination crashes Browseable API when limit=0  #75

Closed
@wiresurfer

Description

@wiresurfer

We are using LimitOffsetPagination on all our endpoints, and noticed that sending limit=0 to the browsable api causes a crash. Getting json output (either from an xmlhttprequest or from format=json) does not crash.

Steps to reproduce

  • Install LimitOffsetPagination as the default pagination
  • Open a list (ours are ModelViewSet) in the browser
  • Set the query string to ?limit=0&offset=20
  • boom

Expected behavior

Should show the browsable api for the endpoint, with the following data:

{
"count":148,
"next":"https://api.co/page/?limit=0&offset=20",
"previous":"https://api.co/page/?limit=0&offset=20",
"results":[]
}

Linked DRF issue

This issue was reported and resolved in DRF a year ago.
encode/django-rest-framework#4079
This was resolved in >3.6.0 of DRF.

Notes

We use a RqlLimitOffset pagination in our project.
Double checking the verision of DRF, we are at 3.14.0
Django-Rql is at 4.4.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions