Closed sergey-litvinov-work closed 4 years ago
Hi Jouke,
Looks like we missed one more case initially. When endpoint doesn't return any items, then links.last will have incorrect result.
links.last
If we would use 1 as first page number, then the response would be
1
{ "data" : [ ], "links" : { "self" : "https://some/v5/equipment/", "first" : "https://some/v5/equipment/?page[number]=1", "last" : "https://some/v5/equipment/?page[number]=0" } }
and last has page[number]=0 that isn't correct and should be the same as first. And if we don't have custom firstPage and by default it's 0, then response would be
last
page[number]=0
first
firstPage
0
{ "data" : [ ], "links" : { "self" : "https://some/v5/equipment/", "first" : "https://some/v5/equipment/?page[number]=1", "last" : "https://some/v5/equipment/?page[number]=-1" } }
This PR is the fix for that logic and also a couple of unit tests to cover this scenario
Thanks!
Hi Jouke,
Looks like we missed one more case initially. When endpoint doesn't return any items, then
links.last
will have incorrect result.If we would use
1
as first page number, then the response would beand
last
haspage[number]=0
that isn't correct and should be the same asfirst
. And if we don't have customfirstPage
and by default it's0
, then response would beThis PR is the fix for that logic and also a couple of unit tests to cover this scenario