Remove magic from `res.set`
Open
6.x
ideas
require-triage
- Dominant language
- JavaScript
- Stars
- 69.5k
- Forks
- 25k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
Currently [`res.set`](https://github.com/expressjs/express/blob/e5099198b292a565f8583d70caf12d7afed3607f/lib/response.js#L664-L686) includes some magic that is probably unexpected for most users. It's only for `content-type`, but if it looks like an invalid content type (no `/`) we do a mime type lookup. In v6 we should change this to avoid mutating user input when setting a header, especially since a method already exists to do this: [`res.type`](https://github.com/expressjs/express/blob/e5099198b292a565f8583d70caf12d7afed3607f/lib/response.js#L503-L510).
This was brought up due to a bug in the logic: https://github.com/expressjs/express/issues/7034.
Contributor guide
Assessment
This issue has not been assessed yet.