Repository navigation
feat(deno): Add maxRequestBodySize to capture HTTP bodies - #22912
Merged
Merged
Conversation
s1gr1d
requested review from
andreiborza and
isaacs
and removed request for
a team
July 31, 2026 10:54
chargome
approved these changes
Jul 31, 2026
3 tasks done
JPeer264
pushed a commit
that referenced
this pull request
Sep 11, 2026
…#24233) - [x] If you've added code that should be tested, please add tests. - [x] Ensure your code lints and the test suite passes (`yarn lint`) & (`yarn test`). - [x] Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked. Ports the Deno body capture from #22912 to `Bun.serve`. Same `maxRequestBodySize` option, same default (`medium` when `httpBodies` includes `incomingRequest`, otherwise `none`), GET skipped, body read before `continueTrace` so it lands on the request data. As on Deno an explicit `maxRequestBodySize` wins over `httpBodies` in both directions. One side effect: `normalizedRequest` now comes from `winterCGRequestToRequestData`, so `query_string` loses the leading `?` and is `undefined` instead of `""` when there is no query. That matches what Deno, Cloudflare and Node already send, and the `url.query` span attribute Bun was already stripping. The body read is awaited before the handler runs and core caps it at 2s, so a client that opens an upload and stalls holds the handler up to 2s even if the handler never reads the body. Same as Deno and Cloudflare, just new for Bun. The isolation scope callback had to go async for the body read, so the wrapper returns a promise now. `Bun.serve` accepts either, and every non HEAD/OPTIONS path was already returning one via `startSpan`. Tests: 10 new in `bunserver.test.ts`, 60/60 green for the package, plus a `request-bodies` suite in `bun-integration-tests`, 14/14 green. Closes #23884 AI disclosure: AI assistance (Claude) was used for research and to draft the tests. The implementation was written and reviewed by the author.
This was referenced Sep 16, 2026
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.
Related to this comment: #22834 (review)
Closes #22858