Remove magic from `res.set`
ideas6.xrequire-triage
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.
1 条评论