HTTP header Content-Length
The Content-Length header indicates the size of the message body, in bytes, sent to the recipient.
- In HTTP/1.0, it is required.
- In HTTP/1.1, it could be replaced with Transfer-Encoding: chunked for responses sent out in parts as its size is calculated.
- In HTTP/2, Content-Length is redundant, because the content length may be inferred from DATA frames. It may still be included for backwards compatibility.
Content-Length: <length>
Examples
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 473
POST /submit HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 27
field=value&other=something