What’s the behavior in Deno when a response body mismatch its length with Content-Length header?

Really curious about if Deno truncates the body (even if is a ReadableStream) when this happens, I read about this at https://www.ibm.com/docs/en/ibm-mq/9.0?topic=headers-content-length-http-entity-header Thanks!
Content-Length: HTTP entity-header
Set or return the length, in bytes, of the body of the message.
2 Replies
AapoAlas
AapoAlas2y ago
I remember that this was quite extensively talked about, tested and finally deemed "as expected" in one PR maybe 4 months prior or so... Although it might also have been about sending bodies instead of receiving. But yes, I believe Deno will trust the content length header as the spec says to do, and a mismatch results in either a truncation or null-padding.
Santiago Aguilar Hernandez
Just double checked with a string and ReadableStream response, setting content-length will truncate the response 😄 @aapoalas thanks for the answer!