Skip to content

feat(client): per-verb *_with_response siblings (0.12.0)#68

Merged
lesnik512 merged 8 commits into
mainfrom
feat/per-verb-with-response
Jun 16, 2026
Merged

feat(client): per-verb *_with_response siblings (0.12.0)#68
lesnik512 merged 8 commits into
mainfrom
feat/per-verb-with-response

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Adds the one-call ergonomic form of send_with_response to both clients: get_with_response, post_with_response, put_with_response, patch_with_response, delete_with_response, and request_with_response on AsyncClient and Client. Each requires response_model and returns tuple[httpx2.Response, T] — for the "I need response metadata and a typed body" case (Link-header pagination, ETag / rate-limit reads) without the build_request(...) + send_with_response(...) two-step.

Closes the deferred "Per-verb-with-response siblings" item. Ships as 0.12.0 (additive, no breaking changes).

What's in it

  • Refactor: extracted _prepare_request from _request_with_body (behavior-preserving) so the plain and with-response paths share request-building.
  • Async + sync siblings: 6 methods per client, delegating through a new _request_with_body_with_response helper to send_with_response. No @overload stubs — single call shape. Inherits MissingDecoderError (pre-HTTP) and DecodeError wrapping for free.
  • Scope: no head/options variant (HEAD is bodiless, OPTIONS rarely decoded); request_with_response(method, url, ...) is the escape hatch.
  • Docs: pagination recipe shorthand + architecture/client.md note + a typing.assert_type test for the (Response, T) return.
  • Version is tag-driven, so pyproject.toml is intentionally not bumped.

Design + plan: planning/changes/active/2026-06-16.01-per-verb-with-response/.

Test plan

  • just test — 678 passed, 100% coverage
  • just lint — clean (ruff format/check + ty)
  • New behavioral tests: both clients × all verbs, header preservation, JSON body forwarding, DecodeError, MissingDecoderError fires before the HTTP call
  • typing.assert_type static-type assertions for the tuple return
  • mkdocs build --strict — clean

🤖 Generated with Claude Code

lesnik512 and others added 8 commits June 16, 2026 09:13
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Design + plan for the get_with_response … request_with_response siblings,
and the Active Index entry. Bundle stays active/draft until merge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ship bookkeeping: mark design.md + plan.md shipped (pr: 68, outcome filled),
move the bundle from changes/active/ to changes/archive/, and flip its Index
line from Active to Archived.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 2b7d9b7 into main Jun 16, 2026
5 checks passed
@lesnik512 lesnik512 deleted the feat/per-verb-with-response branch June 16, 2026 07:10
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