I want to understand the working of Content-Length header and how broswers and servers treat it. I have seen responses without centent-length header and some with content-length. Also, I have seen responses with less value than the actual message body size and browser tuncates the content. I want to know the best practices around the header.
These days, you either need to send an appropriate Content-Length
in your header, or you need to send your response in chunked transfer encoding. An HTTP response with less data than expected is an error.