Skip to content

fix(res.set): ignore inherited header fields#7329

Open
lin-hongkuan wants to merge 1 commit into
expressjs:masterfrom
lin-hongkuan:codex/express-set-own-headers
Open

fix(res.set): ignore inherited header fields#7329
lin-hongkuan wants to merge 1 commit into
expressjs:masterfrom
lin-hongkuan:codex/express-set-own-headers

Conversation

@lin-hongkuan

@lin-hongkuan lin-hongkuan commented Jun 24, 2026

Copy link
Copy Markdown

This changes res.set(object) to iterate over own enumerable keys only, so inherited properties are not copied into response headers.

The regression test passes an object with an inherited X-Inherited field and confirms only the own X-Own header is set.

Validation:

  • npx mocha --require test/support/env --check-leaks test/res.set.js
  • npm run lint
  • git diff --check

AI-assisted: Codex helped prepare this focused change; I reviewed the diff and ran the validation above before submitting.

@krzysdz

krzysdz commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Why should inherited header fields be ignored?

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.

2 participants