unioslo / mreg-cli

Command Line Interface for Mreg
GNU General Public License v3.0
2 stars 7 forks source link

Omit params when fetching paginated content #296

Closed pederhan closed 1 month ago

pederhan commented 1 month ago

Given the path /api/v1/hostpolicy/roles/ and the params {"name__regex": "."}, we send:

/api/v1/hostpolicy/roles/?name__regex=.

And get back this Next URL in the response headers:

/api/v1/hostpolicy/roles/?name__regex=.&page=2

If we pass the original params to get() along with the Next URL, we end up requesting the path:

/api/v1/hostpolicy/roles/?name__regex=.&page=2&name__regex=.'

We should probably just trust that Django gives us a valid Next URL after the first request and omit the original params.