mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
fix: use hasContentLen instead of hasContentLength for header removal
Use the post-headers flag (hasContentLen) that reflects the effective headers after writeHead() obj headers are applied, rather than the initial hasContentLength value. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1187,7 +1187,8 @@ function _writeHead(statusCode, reason, obj, response) {
|
||||
// Trailers cannot be used without chunked encoding
|
||||
if (response.hasHeader("trailer")) {
|
||||
// If "Trailer" header is explicitly set, that's an error
|
||||
if (hasContentLength) {
|
||||
// Use hasContentLen (not hasContentLength) to reflect current headers after obj applied
|
||||
if (hasContentLen) {
|
||||
response.removeHeader("trailer");
|
||||
} else {
|
||||
response.removeHeader("content-length");
|
||||
|
||||
Reference in New Issue
Block a user