Skip to content
Merged
Prev Previous commit
docs: update History.md to include bug fix for HTTP header conflict i…
…n res.send()
  • Loading branch information
bjohansebas committed Jan 17, 2026
commit dddae1894b8cca5f3b8f8f429def8ecf6bb98ab8
7 changes: 7 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Unreleased Changes

## 🐞 Bug fixes

- Fixed HTTP header conflict between Content-Length and Transfer-Encoding in res.send - by [@YuryShkoda](https://github.com/YuryShkoda) in [#4893](https://github.com/expressjs/express/pull/4893)


Fixed the behavior of `res.send()` to prevent conflicts between `Content-Length` and `Transfer-Encoding` HTTP headers in responses. The `Content-Length` header in `res.send()` is now only added when a `Transfer-Encoding` header is not present, complying with the HTTP specification that states both headers should not coexist in the same response

## 🚀 Improvements

- Improve HTML structure in `res.redirect()` responses when HTML format is accepted by adding `<!DOCTYPE html>`, `<title>`, and `<body>` tags for better browser compatibility - by [@Bernice55231](https://github.com/Bernice55231) in [#5167](https://github.com/expressjs/express/pull/5167)
Expand Down
1 change: 0 additions & 1 deletion lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ res.send = function send(body) {
var etagFn = app.get('etag fn')
var generateETag = !this.get('ETag') && typeof etagFn === 'function'

// populate Content-Length
// Because Content-Length and Transfer-Encoding can't be present in the response headers together,
// Content-Length should be added only if there is no Transfer-Encoding header
var len;
Expand Down