Skip to content

docs: point event_hooks at a caller-built httpx2 client - #149

Merged
lesnik512 merged 1 commit into
mainfrom
docs/event-hooks-guidance
Oct 1, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
docs/event-hooks-guidance

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Problem

docs/middleware.md recommends event_hooks "on the wrapped httpx2_client" for low-level transforms. Since 0.18.0 (#148), httpware forwards every httpx2 client option except event_hooks, which it refuses. The guide didn't say why, so the two read as contradictory.

Change

The bullet now says to put hooks on an httpx2 client you build and pass as httpx2_client=, and explains the refusal. An httpx2.HTTPStatusError raised in a hook (for example by raise_for_status()) reaches the chain as a plain TransportError, not a StatusError. AsyncRetry only retries StatusError/NetworkError/TimeoutError, and the circuit breaker only counts those, so the error is neither retried nor counted.

Verification

Checked by hand: a hook calling raise_for_status() on a 503, behind AsyncRetry, raises TransportError after one attempt. mkdocs build --strict passes.

@lesnik512
lesnik512 merged commit 287f426 into main Oct 1, 2026
13 checks passed
@lesnik512
lesnik512 deleted the docs/event-hooks-guidance branch October 1, 2026 12:13
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.

1 participant