HTTP 411 — Length Required
HTTP 411 refuses requests without a Content-Length header when the server insists on knowing the body size up front — its buffering strategy depends on it.
When 411 shows up
- Chunked uploads sent to servers that require explicit lengths.
- Custom HTTP clients that omit length headers on small bodies.
Mocking a 411 response
A response with this status can be faked end to end with a local mock rule — no backend changes needed. The configuration below mirrors the rule fields the ApiSimul editor uses (method, path, status, delay in milliseconds, response body):
{
"method": "GET",
"path": "/api/import",
"status": 411,
"delay": 140,
"enabled": true,
"body": null
}Dynamic placeholders such as {{random.name}}, {{string.uuid}} or {{number.int 1 100}} can appear inside the body to vary each response, which keeps client-side list rendering and retry logic honest during development.
Frequently asked questions
What does HTTP 411 mean?
The request must state its body size via Content-Length before the server will read it. Adding the header (or switching transfer encoding) resolves it.
How can I test a 411 response without a real backend?
Define a mock rule with the method and path your client requests and set the status to 411. The example configuration above returns this response after the listed delay, so the client exercises its 411 handling exactly as it would against a live server.
Related status codes
Need the response in your own project? Spin up rules for any status with the ApiSimul mock server, or browse every status code page.