Fixed pagination parsing for non-numeric IDs
Mastodon API's pagination IDs are not guaranteed to be in a numeric format. This happens to be the case for the tootsuite implementation, but others use UUIDs or flake IDs for pagination. This also simplifies the code a bit and luckily shouldn't break backwards compatibility since they're already of type ID in the Pagination struct.
This commit is contained in:
parent
f51571807d
commit
478dc913c0
2 changed files with 5 additions and 16 deletions
|
@ -294,8 +294,8 @@ func TestNewPagination(t *testing.T) {
|
|||
}
|
||||
|
||||
_, err = newPagination(`<http://example.com?min_id=abc>; rel="prev"`)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
||||
pg, err := newPagination(`<http://example.com?max_id=123>; rel="next", <http://example.com?since_id=789>; rel="prev"`)
|
||||
|
@ -317,8 +317,8 @@ func TestGetPaginationID(t *testing.T) {
|
|||
}
|
||||
|
||||
_, err = getPaginationID("http://example.com?max_id=abc", "max_id")
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
||||
id, err := getPaginationID("http://example.com?max_id=123", "max_id")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue