Content-Length: HTTP entity-header

Set or return the length, in bytes, of the body of the message.

Type Description
HTTP header name Content-Length
HTTP header type Entity-header
Valid in HTTP request message x-msg-require-headers
Allowed and returned value
Integer value
Length in bytes of the message body.

Description

  • The Content-Length is optional in an HTTP request. For a GET or DELETE the length must be zero. For POST, if Content-Length is specified and it does not match the length of the message-line, the message is either truncated, or padded with nulls to the specified length.
  • The Content-Length is always returned in the HTTP response even when there is no content, in which case the value is zero.