Skip to content

fix: preserve existing request body fields#1399

Open
raashish1601 wants to merge 1 commit into
expressjs:mainfrom
raashish1601:codex/preserve-existing-req-body
Open

fix: preserve existing request body fields#1399
raashish1601 wants to merge 1 commit into
expressjs:mainfrom
raashish1601:codex/preserve-existing-req-body

Conversation

@raashish1601

Copy link
Copy Markdown

Summary

Preserve existing own req.body properties when Multer initializes multipart parsing, instead of replacing them with an empty object.

Multer still uses a null-prototype object for req.body; it copies existing own enumerable properties into that object before appending multipart fields.

Fixes #1187.

Validation

  • npm run lint
  • npx mocha --reporter spec --exit --check-leaks test/fields.js

I also ran npm test; it reached the new regression successfully, but the full suite fails in this Windows checkout on existing fixture byte-size and POSIX path assertions unrelated to this change, for example 1803 !== 1778 in storage/file size tests and /testforme- path matching.

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.

[BUG] Multer overriding req.body contents, if any of express middleware add custom keys to req.body

1 participant