Repository navigation
Conversation
The response side already returns raw bytes. The request side only took a JSON payload, so apps taking an image or audio needed a base64 shim. `data` and `content_type` send the bytes as is, exclusive with `payload`. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No blocking correctness issues were found; remaining documentation and regression-coverage suggestions are non-blocking.
2 open findings
What changed in this PR
Adds raw-byte request bodies to call_runner, allowing binary inputs without base64 encoding while preserving JSON behavior.
Changes:
- Adds mutually exclusive
dataandpayloadarguments with configurable content type. - Forwards raw bodies through buffered, streaming, and payment-retry paths.
- Adds request-body tests and a changelog entry.
| File | Description |
|---|---|
| tests/test_call_runner_request_bytes.py | Tests binary bodies, JSON compatibility, streaming, and argument validation. |
| src/livepeer_gateway/live_runner.py | Exposes and forwards raw-body arguments. |
| src/livepeer_gateway/http.py | Supports bytes and content types in HTTP helpers. |
| CHANGELOG.md | Documents binary request support. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+817
to
+818
| for apps that take an image, audio or any other binary body. Raise ``timeout`` for | ||
| large bodies, since it bounds the whole request. |
Comment on lines
+829
to
+830
| body_kwargs: dict[str, Any] = ( | ||
| {"data": data, "content_type": content_type} if data is not None else {} |
rickstaa
marked this pull request as draft
October 15, 2026 13:58
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Matches `result.content` on the response side, and stops `data` meaning the JSON dict on the result but raw bytes on the request. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Also cover that a paid retry re-sends the raw body unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Collaborator
|
Thanks for this. I extended things to also support streamable request bodies - the change turned out to be larger than I anticipated but I think it's a pretty good example of a tidy API that hides a lot of complexity. #80 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

call_runnercan already return raw bytes (result.contentandresult.content_type), but the request body was always JSON. Apps that take an image or audio needed a base64 shim on both sides.This adds
content(bytes) andcontent_type(defaultapplication/octet-stream) as an alternative topayload, mirroringresult.contentandresult.content_typeon the way back. The bytes are sent as is. Passing bothpayloadandcontentraises an error. It works with the paid retry and withstream=True. JSON calls are unchanged, since the new arguments are only passed down whencontentis set.timeoutis the total time for each buffered request attempt, so large bodies need a larger value. It restarts on every payment retry and is not applied whenstream=True. Streaming a body from an iterator is not included.Tests: the request-side cases are in
tests/test_call_runner_raw.py, in a new "Requests" section beside the existing "Responses" ones (bytes sent unchanged with the given content type, default content type, empty body, JSON unchanged, streaming, and the mutual exclusion).tests/test_live_runner.pyhas a paid-retry test showing the 402 retry re-sends the raw body.