Closed
Description
Version
v22.13.0
Platform
Linux razer 6.13.6-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Mar 7 21:33:48 UTC 2025 x86_64 GNU/Linux
Subsystem
http
What steps will reproduce the bug?
- Use following code
import http from "node:http"; http.createServer((req, res) => { res.strictContentLength = true; res.setHeader("content-length", "5"); res.end("12345"); }).listen(3000);
- Send any HTTP request to the server on port 3000
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
Should not throw error.
What do you see instead?
Error [ERR_HTTP_CONTENT_LENGTH_MISMATCH]: Response body's content-length of 5 byte(s) does not match the content-length of 5 byte(s) set in header
node:_http_outgoing:1129
throw new ERR_HTTP_CONTENT_LENGTH_MISMATCH(this[kBytesWritten], this._contentLength);
^
Error [ERR_HTTP_CONTENT_LENGTH_MISMATCH]: Response body's content-length of 5 byte(s) does not match the content-length of 5 byte(s) set in header
at ServerResponse.end (node:_http_outgoing:1129:11)
at Server.<anonymous> (file:///home/zefir/Projects/web-ts/test/test.js:5:9)
at Server.emit (node:events:524:28)
at parserOnIncoming (node:_http_server:1153:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17) {
code: 'ERR_HTTP_CONTENT_LENGTH_MISMATCH'
}
Node.js v22.13.0
Additional information
No response
Metadata
Metadata
Assignees
Labels
No labels