Skip to content

fix: avoid mutating read options when reading body#742

Merged
Phillip9587 merged 1 commit into
expressjs:masterfrom
Phillip9587:read-shared-options
Jul 13, 2026
Merged

fix: avoid mutating read options when reading body#742
Phillip9587 merged 1 commit into
expressjs:masterfrom
Phillip9587:read-shared-options

Conversation

@Phillip9587

Copy link
Copy Markdown
Member

The parser read options were created once per middleware instance and reused for each request. read() was aliasing that shared object and adding per-request length and encoding fields before passing it to raw-body.

Pass raw-body an explicit rawBodyOptions object containing the per-request values it needs.

The parser read options were created once per middleware instance and reused for each request. `read()` was aliasing that shared object and adding per-request `length` and `encoding` fields before passing it to `raw-body`.

Pass `raw-body` an explicit `rawBodyOptions` object containing the per-request values it needs.

@bjohansebas bjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Phillip9587 Phillip9587 merged commit 9da9424 into expressjs:master Jul 13, 2026
17 checks passed
@Phillip9587 Phillip9587 deleted the read-shared-options branch July 13, 2026 20:50
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.

3 participants