Send single-message requests as a sized body - #346
Merged
anuraaga merged 3 commits intoSep 24, 2026
Merged
Conversation
Server-streaming calls, and unary calls over gRPC and gRPC-Web, send one request message, but the clients handed it to the transport as a streamed body: chunked on HTTP/1.1, and in the async client produced by the event loop only after the headers were written, so a busy loop left the server with headers and no body. Encode the message up front and pass the bytes, as unary Connect calls already do, so the transport writes the whole request with a Content-Length. Client- and bidi-streaming requests still stream. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Tao Lin <tao.lin@radixark.ai>
nblintao
force-pushed
the
send-single-message-requests-sized
branch
from
September 23, 2026 23:44
1523ce8 to
ef06bb5
Compare
nblintao
marked this pull request as ready for review
September 23, 2026 23:44
anuraaga
approved these changes
Sep 24, 2026
anuraaga
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @nblintao! I was worried this would be quite tricky but the approach looks pretty good. There is one point we have to remember for the future, if the public APIs accept list in the future for convenience reasons, I added a comment about it to not forget
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.
Server-streaming calls, and unary calls over gRPC and gRPC-Web, send exactly one request message, but both clients hand it to the transport as a streamed body:
Transfer-Encoding: chunked, although its size is known before the call starts.This change encodes the message up front and passes the bytes to
stream(), as unary Connect calls already do withpost(), so the transport writes the whole request with aContent-Length. Client-streaming and bidi-streaming requests still stream. connect-go sends server-streaming requests the same way since connectrpc/connect-go#649, and connect-web sends them as a single body too.Validation:
transfer-encoding: chunkedand the body 2 s later; after it, headers and body arrive in the same read, withcontent-length.uv run poe checkanduv run poe test-conformancepass.🤖 Generated with Claude Code