From 960e5db2fefa1a3d5a7469ddd7f88f1fabfd174a Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Fri, 16 Jan 2026 18:15:20 +0000 Subject: [PATCH] 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 --- src/js/node/_http_server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/node/_http_server.ts b/src/js/node/_http_server.ts index d45cc321e3..dedd786ab9 100644 --- a/src/js/node/_http_server.ts +++ b/src/js/node/_http_server.ts @@ -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");