Don't strip empty query params when paginating by npars · Pull Request #4260 · encode/django-rest-framework (original) (raw)
The request
object received by the View
treats empty query params and missing query params differently:
GET http://testserver/?filter=
(Pdb) repr(request.query_params.get('filter'))
"u''"
(Pdb) repr(request.query_params.get('filter'))
'None'
This means that when paginating the next and previous pages could contain a completely different data set from the current query if the API is relying on this behaviour.
We currently have an implementation that uses this behaviour for passing search strings into the API. An empty search string is considered valid and returns different results than when the search param is not provided at all. As a result of this only the first page from DRF is valid, all subsequent pages contain the incorrect dataset.