I think that it's probably more work than it's worth to detect for that case and error for how rare it is. Might as well just ignore it.

Between checking on the initial request to see max page # and keep requesting until data.length < page_size, I think the latter is more elegant, but I think it's mostly a horse apiece.