Skip to content

feat(deno): Add maxRequestBodySize to capture HTTP bodies - #22912

Merged
s1gr1d merged 1 commit into
developfrom
sig/capture-deno-bodies
Jul 31, 2026
Merged

s1gr1d merged 1 commit into
developfrom
sig/capture-deno-bodies

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Jul 31, 2026

Copy link
Copy Markdown
Member

Related to this comment: #22834 (review)

Closes #22858

@s1gr1d
s1gr1d requested a review from a team as a code owner July 31, 2026 10:54
@s1gr1d
s1gr1d requested review from andreiborza and isaacs and removed request for a team July 31, 2026 10:54
@s1gr1d
s1gr1d merged commit 57fddd7 into develop Jul 31, 2026
56 checks passed
@s1gr1d
s1gr1d deleted the sig/capture-deno-bodies branch July 31, 2026 14:28
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v11]: Send HTTP Body in Deno

2 participants