parent
42ed8522fd
commit
18097a1bd6
2 changed files with 9 additions and 4 deletions
|
@ -59,8 +59,9 @@ def paginate(limit_kwarg_name='limit', offset_kwarg_name='offset',
|
|||
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})
|
||||
link_url = get_app_url() + url_for(request.endpoint, **request.view_args)
|
||||
link_param = urlencode({'n': limit, 'next_page': next_page_token})
|
||||
link = '<%s?%s>; rel="next"' % (link_url, link_param)
|
||||
response.headers['Link'] = link
|
||||
|
||||
kwargs[limit_kwarg_name] = limit
|
||||
|
|
|
@ -1377,11 +1377,15 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix
|
|||
break
|
||||
|
||||
# Check the next page of results.
|
||||
link = result.headers['Link']
|
||||
link_header = result.headers['Link']
|
||||
self.assertTrue(link_header.startswith('<'))
|
||||
self.assertTrue(link_header.endswith('>; rel="next"'))
|
||||
|
||||
link = link_header[1:]
|
||||
self.assertTrue(link.endswith('; rel="next"'))
|
||||
|
||||
url, _ = link.split(';')
|
||||
relative_url = url[len(self.get_server_url()):]
|
||||
relative_url = url[len(self.get_server_url()):-1]
|
||||
|
||||
encountered.update(set(result_json['tags']))
|
||||
|
||||
|
|
Reference in a new issue