httpstatuses/contents/codes/204.md

48 lines
1.9 KiB
Markdown
Raw Normal View History

2015-11-06 21:39:33 +01:00
---
set: 2
code: 204
title: No Content
references:
"Rails HTTP Status Symbol": ":no_content"
2016-01-27 23:08:33 +01:00
"Go HTTP Status Constant": "http.StatusNoContent"
2015-11-06 21:39:33 +01:00
---
The server has successfully fulfilled the request and that there is no
additional content to send in the response payload body.
Metadata in the response header fields refer to the target resource and its
selected representation after the requested action was applied.
For example, if a 204 status code is received in response to a PUT request and
the response contains an ETag header field, then the PUT was successful and the
ETag field-value contains the entity-tag for the new representation of that
target resource.
The 204 response allows a server to indicate that the action has been
successfully applied to the target resource, while implying that the user agent
does not need to traverse away from its current "document view" (if any). The
server assumes that the user agent will provide some indication of the success
to its user, in accord with its own interface, and apply any new or updated
metadata in the response to its active representation.
For example, a 204 status code is commonly used with document editing interfaces
corresponding to a "save" action, such that the document being saved remains
available to the user for editing. It is also frequently used with interfaces
that expect automated data transfers to be prevalent, such as within distributed
version control systems.
A 204 response is terminated by the first empty line after the header fields
because it cannot contain a message body.
A 204 response is cacheable by default; i.e., unless otherwise indicated by the
method definition or explicit cache controls<sup>[1](#ref-1)</sup>.
---
* <span id="ref-1"><sup>1</sup> Calculating Heuristic Freshness
[RFC7234 Section 4.2.2][2]</span>
* Source: [RFC7231 Section 6.3.5][1]
[1]: <http://tools.ietf.org/html/rfc7231#section-6.3.5>
2016-01-27 23:08:33 +01:00
[2]: <http://tools.ietf.org/html/rfc7234#section-4.2.2>