feat(server): describe batch binary responses with a dedicated content type - #1761
Merged
dinwwwh merged 1 commit intoAug 2, 2026
Merged
Conversation
…t type Batch responses that use the length-prefixed binary framing fell back to `application/octet-stream`, which says "unknown bytes" for a format oRPC defines. Advertise `application/vnd.orpc.batch` instead so logs, proxies and dev tools can tell batch traffic apart from file transfers. Decoding is unaffected: clients resolve the body from the `standard-server` hint, not content-type.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/experimental-effect
@orpc/evlog
@orpc/json-schema
@orpc/nest
@orpc/next
@orpc/openapi
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
BATCH_CONTENT_TYPEconstant — a newapplication/vnd.orpc.batchcontent type exported from the batch plugin, used to describe batch responses that carry the length-prefixed binary framing.- Buffered binary path — the
Blobtype changes fromapplication/octet-streamto the new constant. No behavioral change:toFetchBodyalways overwrites thecontent-typeheader with the Blob's type, so the old and new code are indistinguishable at the adapter layer. - Streaming path — the
content-typeheader is now explicitly set on the response (previously it defaulted toapplication/octet-streamfrom the adapter's??=fallback). The new constant wins over any user-providedheadersoption for consistency with buffered mode. - Compression — the new type is not in the compressible allow-list regex, preserving the existing behavior of not compressing batch binary payloads.
- Tests — both the buffered-binary and streaming test cases assert the new content-type header.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
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.

Batch responses that use the length-prefixed binary framing — streaming mode, and buffered mode when a sub-response carries binary — now advertise
application/vnd.orpc.batchinstead of falling back toapplication/octet-stream. Batch traffic is now distinguishable from ordinary file transfers in proxy logs, CDN rules, and dev tools, where before it was indistinguishable from any other opaque byte stream.application/octet-streammeans "unknown bytes" and was never chosen for batch — it is what the adapter fills in for anyReadableStreambody with no content type set. The framing is a format oRPC defines, so it gets a name.Compatibility
Nothing changes on the wire. Clients resolve the batch body from the
standard-serverhint (octet-stream/file), not fromcontent-type, so old clients read new servers and new clients read old servers. Compression behavior is also unchanged: the new type sits outside the compressible allow-list, exactly like the old one, so batch bodies are still passed through untouched.A
+jsonsuffix was considered and rejected — it would assert the whole body is JSON (it is binary length prefixes wrapping JSON, sometimes with raw binary appended), and it would pull streaming batches intoCompressionStream, which does not sync-flush per chunk and would hold frames back instead of delivering them as each sub-request completes.The all-JSON buffered path is untouched and still serializes as
application/json. In streaming mode the plugin's content type wins over theheadersoption, matching buffered mode, which already hardcodes the type on theBlob.Testing
Both framing paths assert the new header. Full root suite passes (2772 passed, 41 skipped), along with
pnpm type:checkacross all packages andpnpm lint.