Fix tags API pagination and add a test
This commit is contained in:
parent
671dc73b82
commit
f72cb1d2ba
2 changed files with 74 additions and 33 deletions
|
@ -55,8 +55,9 @@ def paginate(limit_kwarg_name='limit', offset_kwarg_name='offset',
|
|||
offset = page_info.get('offset', 0)
|
||||
|
||||
def callback(num_results, response):
|
||||
if num_results <= limit:
|
||||
if num_results < limit:
|
||||
return
|
||||
|
||||
next_page_token = encrypt_page_token({'offset': limit + offset})
|
||||
link = get_app_url() + url_for(request.endpoint, **request.view_args)
|
||||
link += '?%s; rel="next"' % urlencode({'n': limit, 'next_page': next_page_token})
|
||||
|
|
Reference in a new issue