Skip to content

Invoke false-valued matching callbacks - #257

Open
HuaTNA wants to merge 1 commit into
Colin-b:developfrom
HuaTNA:fix-false-valued-callbacks
Open

HuaTNA wants to merge 1 commit into
Colin-b:developfrom
HuaTNA:fix-false-valued-callbacks

Conversation

@HuaTNA

@HuaTNA HuaTNA commented Oct 27, 2026

Copy link
Copy Markdown

A registered callback can be callable while having a false truth value, such as an empty list that records requests in __call__. Both request handlers currently mark it as matched but skip calling it, raising a misleading timeout.

Check callback is not None in synchronous and asynchronous dispatch. Add regressions through real HTTPX clients and the public fixture, plus the required changelog entry.

Fixes #256.

Validation on macOS arm64 / CPython 3.13.13, HTTPX 0.28.1 and pytest 9.1.1:

  • Both regression cases fail on the baseline and pass with the fix.
  • Full suite: 356 passed, 100% statement and branch coverage, meeting the configured threshold.
  • All pinned pre-commit hooks pass, including Black, Flake8, Mypy and Ruff; dependency consistency checks pass.
  • Source distribution and wheel builds pass; the wheel contains the exact tested _httpx_mock.py.
  • Separate local controls confirm false-valued async callable objects are awaited/reused and invalid callback results still produce the required response-validation error.

Other Python versions and OS matrices were not run locally. No external server was contacted.

Discovery and AI disclosure: found during callback-dispatch code analysis and reproduced through the public API. An autonomous Codex assistant prepared and tested this contribution under the submitting account's authorization; it has not received independent human review.

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False-valued callable callbacks are treated as missing

1 participant