Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The Python SDK can currently forward dict responses containing both body and bodyBase64, violating the documented wire-protocol mutual-exclusion rule.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR extends the Owncast plugin SDKs and test harness to support binary HTTP response bodies by encoding raw bytes on the JSON wire via a new bodyBase64 field (per owncast/owncast#5188), and documents the Owncast v0.3.1+ host requirement for this behavior.
Changes:
- JavaScript SDK: allow
OutgoingHttpResponse.bodyto beUint8Arrayand emitbodyBase64on the wire when present. - Python SDK: accept
bytes/bytearrayHTTP bodies and encode them tobodyBase64. - Host test runner + example scenarios: add
bodyBase64assertions for exact binary matching, including invalid UTF-8 round-trips, plus protocol/author docs updates.
File summaries
| File | Description |
|---|---|
| sdks/python/README.md | Documents Python HTTP handlers returning bytes (needs mention of bytearray too). |
| sdks/python/owncast_plugin/init.py | Encodes bytes/bytearray HTTP bodies into bodyBase64 for the wire. |
| sdks/js/index.js | Adds base64 encoding for Uint8Array HTTP bodies and emits bodyBase64. |
| sdks/js/index.d.ts | Updates TS types/docs: body?: string | Uint8Array. |
| host-runtime/plugin/testing/scenario.go | Adds bodyBase64 to HTTP expectation schema. |
| host-runtime/plugin/testing/runner.go | Adds exact binary assertions for HTTP responses via bodyBase64. |
| examples/python/all-permissions-test/src/plugin.py | Returns raw bytes from HTTP handler to exercise binary response path. |
| examples/python/all-permissions-test/tests/binary.test.json | Updates scenario to assert binary HTTP response with bodyBase64. |
| examples/js/all-permissions-test/src/plugin.js | Adds an endpoint that returns binary bytes (Uint8Array) with octet-stream content type. |
| examples/js/all-permissions-test/tests/binary.test.json | New JS scenario asserting raw binary HTTP response via bodyBase64. |
| docs/WIRE_PROTOCOL.md | Defines bodyBase64 and the mutual-exclusion rule vs body; documents v0.3.1+ requirement. |
| docs/PLUGIN_AUTHOR_GUIDE.md | Documents returning bytes from JS/Python and adds bodyBase64 to HTTP test expectations; updates envelope cap to 16 MiB. |
Review details
- Files reviewed: 11/12 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gabek
force-pushed
the
gek/binary-http-responses-v031
branch
from
September 18, 2026 17:20
53789c7 to
e7a40da
Compare
gabek
force-pushed
the
gek/binary-http-responses-v031
branch
from
September 18, 2026 17:53
e7a40da to
258b33b
Compare
Member
Author
|
@copilot review |
Co-authored-by: gabek <414923+gabek@users.noreply.github.com>
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.
This adds byte response bodies to the JavaScript and Python SDKs for owncast/owncast#5189.
Uint8Arrayin JavaScript andbytesorbytearrayin Python.I ran
go test ./...inhost-runtime, then ran the JavaScript and Python binary scenarios through the rebuilt host test binary. Both passed.