Repository navigation
Conversation
… one The proxy streamed the request body only for POST, PUT, PATCH and DELETE, but forwarded Content-Length for every method. A GET with a body (Elasticsearch-style search, for example) reached the backend with a Content-Length and no body, httpx failed with "Too little data for declared Content-Length", and the client got a 500. Also stream the body when the request declares one with Content-Length or Transfer-Encoding. Requests without a body are unchanged.
acodercat
requested review from
Generalwin,
Pangjiping,
hittyt,
jwx0925 and
ninan-nn
as code owners
October 31, 2026 08:40
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Move the condition into _request_has_body, next to the other proxy helpers, so the call site reads as what it decides.
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.
The server proxy (
/sandboxes/{id}/proxy/{port}/...) streams the request body to the sandbox only for POST, PUT, PATCH and DELETE. For any other method it sends no body, but it still forwards the client'sContent-Length, which is not a hop-by-hop header.So a GET with a body, as used by Elasticsearch-style search APIs, fails on current main. The backend receives
content-length: 7and no body, httpx raises "Too little data for declared Content-Length", that ends in the generic handler, and the client gets500 GENERAL::UNKNOWN_ERROR.Summary
Content-LengthorTransfer-Encoding, as RFC 9112 defines it. POST, PUT, PATCH and DELETE are streamed as before.Testing
Not run (explain why)
Unit tests
Integration tests
e2e / manual verification
New
test_proxy_forwards_get_request_with_body: a GET with a body must forward itsContent-Lengthtogether with the body. It fails on current main.Checked by hand against a raw-socket backend with the real
httpx.AsyncClient: current main returns 500, and with this change the backend gets the body and the client gets 200.The full server suite passes (2698 passed).
ruffandpyrightare clean.Breaking Changes
Checklist