Why responses to PUT requests MUST NOT provide an ETag?

后端 未结 1 1917
借酒劲吻你
借酒劲吻你 2021-01-13 04:30

From Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content:

An origin server MUST NOT send a validator header field (Section

相关标签:
1条回答
  • 2021-01-13 05:10

    The key point is that the server may, or may not, alter the representation before storing it. From the section you linked to:

    A successful PUT of a given representation would suggest that a subsequent GET on that same target resource will result in an equivalent representation being sent in a 200 (OK) response. However, there is no guarantee that such a state change will be observable, since the target... might be subject to dynamic processing by the origin server.

    Therefore, the standard uses the presence or absence of the validator header to indicate to the user agent whether or not the representation has been altered.

    If the representation hasn't been altered, then the server can return the validator header field, and the user agent can use that to conditionally validate the representation it just sent.

    If the representation has been altered, then the user agent's representation is, by definition, invalid. Therefore no validator header is returned, and the user agent will have to do an unconditional GET.

    0 讨论(0)
提交回复
热议问题