Skip to content

fix(paginator): preserve URL query parameters when fetching subsequent pages - #143

Open
jdabid wants to merge 1 commit into
fintoc-com:masterfrom
jdabid:fix/preserve-query-params-in-paginator
Open

jdabid wants to merge 1 commit into
fintoc-com:masterfrom
jdabid:fix/preserve-query-params-in-paginator

Conversation

@jdabid

@jdabid jdabid commented Nov 14, 2026

Copy link
Copy Markdown

Summary

Fix query parameter stripping in fintoc.paginator.request when fetching subsequent pages, preventing infinite loops in paginated resource generators under modern httpx versions.

Details

In fintoc/paginator.py:

  • Replaced mutable default arguments params: dict = {} and headers: dict = {} with None.
  • Passed params=params or None into httpx.Request, ensuring that existing query parameters in the target URL (such as page=2 provided by the Link header in next) are preserved rather than overwritten by an empty parameter mapping.
  • Renamed the local link_headers variable in request() to prevent shadowing the input argument headers.
  • Added regression tests in tests/test_paginator.py ensuring that request() and paginate() preserve query parameters across page transitions.

Release notes

  • Fix pagination infinite loop caused by query parameters being stripped on subsequent page requests.

@fin-review fin-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant