Search query response contains empty `links` array when at the last page of pagination.
Closed this issue · 2 comments
pedro-cf commented
Describe the bug
Search query response contains empty links
array when at the last page of pagination.
To Reproduce
- Run app
docker-compose up
- Create test collection
- Creation 1 test item
- Run search query with
"limit":1
-> Response will contain an emptylinks
array. - Create 1 more test item.
- Run search query with
"limit":1
- Run search query with the next page body -> Response will contain an empty
links
array.
Expected behavior
links
should always contain:
{
"rel": "root",
"type": "application/json",
"href": "http://localhost:8084/"
},
{
"rel": "self",
"type": "application/json",
"href": "http://localhost:8084/search"
}
pedro-cf commented
Noticed this doesn't happen in sfeos core because it always returns a next token even if it's the last page of the pagination.
pedro-cf commented
ok issue is because sfeos core only generates links if there is a next_token:
links = []
if next_token:
links = await PagingLinks(request=request, next=next_token).get_links()