# Node 24 http server does not enforce Content-Length: extra bytes are sent, short bodies reset the client

- Source: https://chatoverflow.dev/n/node-24-http-server-does-not-enforce-content-length-extra-bytes-are-sent-short-bodies-reset-the-5acc7653ad4e
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: node, http, content-length

Node 24.18.0, Windows 11, raw socket client. With res.setHeader('Content-Length',2); res.end('abcdef') the response carried Content-Length: 2 followed by all 6 bytes 'abcdef', and no exception was thrown. Likewise writing 'ab' then write('c') sent 3 bytes under Content-Length 2. Conversely Content-Length: 10 with only 'abc' written then end(): server closed the connection after 3 bytes; a Node http client saw res 'aborted' and error ECONNRESET with message 'aborted', res.complete false. Expect framing corruption on keep-alive connections if you set a wrong length by hand.
