Skip to content

Preserve whole-body binary HTTPX responses - #13

Merged
kdubb merged 2 commits into
mainfrom
codex/issue-12-binary-responses
Oct 16, 2026
Merged

kdubb merged 2 commits into
mainfrom
codex/issue-12-binary-responses

Conversation

@kdubb

@kdubb kdubb commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Whole-body binary downloads currently pass through media codecs before bytes validation: arbitrary formats fail, JSON assets fail validation, and non-UTF-8 text assets can silently change bytes. Add ResponseSpec(binary_body=True) so HTTPX preserves the body bytes, including empty bodies, while retaining status/media checks, typed headers, structured decoding, and normal error handling. Carry binary media declarations into Accept negotiation.

Addresses #12.

Coordinated release dependency

This runtime change and the companion Sunday Generator change must ship together for generated clients. Release the runtime first, then update the generator's pinned Python runtime tag, validate against that published runtime, and release the generator. Consumers must regenerate their clients; upgrading the runtime alone cannot identify binary responses in older generated code. Keep issue #12 open until the coordinated releases and downstream verification are complete.

Companion generator PR (draft until the runtime release and pin update): outfoxx/sunday-generator#275.

Validation

  • 527 runtime tests passed; 92.66% coverage.
  • Ruff formatting/lint and strict mypy passed.
  • Wheel and source distribution built; Twine and wheel metadata checks passed.
  • 186 Python generator tests passed against this local runtime checkout, including compiled download regressions across RAML/OpenAPI and composed inputs, with AsyncAPI streaming compatibility coverage.

These are local results; hosted CI runs separately. No release has been published.

Add response-specific binary decoding and Accept negotiation, preserving empty bodies and typed response metadata. Cover arbitrary media types and document the generator release dependency.
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the wildcard fix preserves rejection of disjoint media types.

Summary

Adds ResponseSpec(binary_body=True) to preserve whole-body bytes while keeping response checks and typed headers.

  • HTTPX callers can receive whole response bodies as bytes.

The previous unnumbered finding is fully addressed. No new actionable issues were found in the changes since the last review.

Reviews (3) · Last reviewed commit: "Accept overlapping binary response media..." · Reviewed by Greptile

Comment thread src/sunday/httpx/_transport.py Outdated
Check Accept and binary response declarations in both matching directions. Cover broader request and response ranges, structured suffix wildcards, and rejection of disjoint ranges through both operation APIs.
@kdubb
kdubb merged commit d0b9521 into main Oct 16, 2026
6 checks passed
@kdubb
kdubb deleted the codex/issue-12-binary-responses branch October 16, 2026 00:40
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