1. HTTP (Hypertext Transfer Protocol)

  1. HTTP Status Codes

  1. 204 No Content
    1. Writing responses (servers)
      1. In HTTP/1
      2. In HTTP/2
    2. Reading responses (clients)
    3. Overview table
    4. Example

204 No Content

The 204 No Content status code indicates that the request was successful and the response has no body.

Writing responses (servers)

204 No Content may be used when the payload size is zero, and the status would otherwise be 200 OK. These are typically PUT, PATCH, or DELETE requests made with return=minimal.

It is typically more straightforward to always use 200 OK with an explicit Content-Length: 0 header.

This status code implies the request has been filled; the result just has no content. If the response is omitted because of a conditional header, but would otherwise have content, see 304 Not Modified.

In HTTP/1

This status code may be used as an alternative to a 200 OK response with a zero-length payload; in this case, the Content-Length header may be omitted. However, it is more consistent to simply send 200 OK instead.

In HTTP/2

In HTTP/2, headers are not used for payload transfer, so 204 No Content behaves identically to 200 OK.

Reading responses (clients)

Handling of 204 No Content is the same as a 200 OK with a zero-length payload, even if the server omits the Content-Length and Transfer-Encoding headers, one of which would normally be necessary in HTTP/1.1.

Overview table

Name
204
Message
204 No Content
Description
The request was successful and the response has no body.
Specification
RFC 7231: HTTP/1.1 Semantics and Content ยง6.3.3. 204 No Content

Example

HTTP/1.1 204 No Content