json-api-php
json-api-php copied to clipboard
Paging links are duplicated unless removed from URI
Unless the pagination links are removed from the URI passed to Document::addPaginationLinks() the output will be duplicated:
"links": {
"first": "https:\/\/api.acme.net\/users?page%5Blimit%5D=5?page%5Blimit%5D=5",
"next": "https:\/\/api.acme.net/users?page%5Blimit%5D=5?page%5Blimit%5D=5&page%5Boffset%5D=5"
}
It should be clearly documented that the passed URI must be stripped of query parameters or addPaginationLinks should automatically strip them.
The second parameter is an array of query parameters, so that should make it clear, right? On the other hand, maybe the first parameter can be called $path?
In any case, any improvements should probably be added to the new API.
@franzliedke I'm not sure what the correct solution is, perhaps just discarding ?.* from the $uri. Right now the documentation just isn't clear about the fact that query params should not be in $uri.