Is an HTTP PUT request required to include a body?

HTTP requests have a body if they have a Content-Length or Transfer-Encoding header (RFC 2616 4.3). If the request has neither, it has no body, and your server should treat it as such.

That said it is unusual for a PUT request to have no body, and so if I were designing a client that really wanted to send an empty body, I’d pass Content-Length: 0. Indeed, depending on one’s reading of the POST and PUT method definitions (RFC 2616 9.5, 9.6) one might argue that the body is implied to be required – but a reasonable way to handle no body would be to assume a zero-length body.

Leave a Comment