0.12.0 — per-verb *_with_response siblings
httpware 0.12.0 — per-verb *_with_response siblings
Minor release. Additive only — no breaking changes.
This release adds ergonomic per-verb shortcuts for the common pattern of needing
both the raw httpx2.Response (headers, status, request URL) and a typed body in
a single call — without having to pair build_request(...) with
send_with_response(...).
New public names
Six methods on both AsyncClient and Client:
from httpware import AsyncClient
client = AsyncClient(base_url="https://api.example.com", decoders=[...])
# One call — response metadata and typed body together
response, users = await client.get_with_response(
"/users", params={"page": 2}, response_model=list[User]
)
next_url = response.headers.get("Link")
etag = response.headers.get("ETag")| Method | Verb |
|---|---|
get_with_response |
GET |
post_with_response |
POST |
put_with_response |
PUT |
patch_with_response |
PATCH |
delete_with_response |
DELETE |
request_with_response |
any |
Details
Signature: each method requires response_model (keyword-only) and returns
tuple[httpx2.Response, T]. All other kwargs (params, headers, json,
content, timeout, …) pass through to httpx2 unchanged — identical to the
non-_with_response siblings.
Use case: response metadata alongside a typed body — Link-header pagination,
ETag caching, rate-limit reads (X-RateLimit-Remaining), request URL logging on
redirect. When you don't need the raw response, the existing get / post /
… methods remain the preferred form.
Scope: no head_with_response or options_with_response — HEAD is
bodiless and OPTIONS is rarely decoded. request_with_response(method, url, …)
is the escape hatch for any other verb.
Inherited behavior: MissingDecoderError is raised before the HTTP call
when no decoder claims the model type; DecodeError wraps a failure inside
decode(). Both propagate unchanged through the new methods, identical to
send_with_response.
Shipped via
PR #68 — per-verb *_with_response siblings on AsyncClient and Client
(src/httpware/client.py).