Web developmentVeröffentlicht 4. Okt.
FastAPI expenses API: fix paginated listing
The expenses list ignores the offset and returns the wrong slice for page 2+.
Beschreibung
We run a small FastAPI service that stores expenses in memory and serves them with pagination.
Problem: clients that request the second page get the wrong rows. `GET /expenses?skip=2&limit=2` should return items 3 and 4, but the response does not match the offset. The total counter is fine.
Expected:
- `skip` and `limit` behave like standard offset pagination;
- no regression for `skip=0`;
- keep the response shape (`total`, `items`) unchanged.
Acceptance: `python -m unittest discover -s tests` passes (FastAPI + httpx required).
Message me and I'll send the repo with the failing test. I can pay by card or PayPal, whatever is easier.
Fähigkeiten
- Python
- FastAPI
- REST API