411 Length Required
The HTTP411 Length Requiredclient error response status code indicates that the server refused to accept the request without a definedContent-Length header.
Note:When sending data in a series of chunks, theContent-Length header is omitted, and at the beginning of each chunk, the length of the current chunk needs to be included in hexadecimal format.SeeTransfer-Encoding for more details.
In this article
Status
http
411 Length RequiredExamples
>Chunked POST request
The following request is sent chunked, which is the default method of sending data in some cases, such as whenwriting to streams:
http
POST /translate/de HTTP/1.1Host: api.example.comContent-Type: application/jsonTransfer-encoding: chunked2C{"text": "Hurry up, Ayşe is hungry!"}0In this case, the server is expecting a request in one part with aContent-Length header and returns a 411 response:
http
HTTP/1.1 411 Length RequiredContent-Type: application/jsonContent-Length: 110{ "message": "Requests must have a content length header.", "documentation": "http://api/example.com/docs/errors",}Specifications
| Specification |
|---|
| HTTP Semantics> # status.411> |