2.1. 一个简单的 PATCH 示例 (A Simple PATCH Example)
2.1. 一个简单的 PATCH 示例 (A Simple PATCH Example)
PATCH /file.txt HTTP/1.1
Host: www.example.com
Content-Type: application/example
If-Match: "e0023aa4e"
Content-Length: 100
[description of changes]
此示例展示了如何在现有资源上使用一个假想的 patch document.
响应:
HTTP/1.1 204 No Content
Content-Location: /file.txt
ETag: "e0023aa4f"
这里使用 204 response code, 因为响应不携带 message body, 而 200 code 的响应会携带 message body. 注意, 也可以使用其他成功代码.
此外, ETag response header field 包含通过应用 PATCH 创建的 entity 的 ETag. 如 Content-Location response header field 所示, 该 entity 可在 http://www.example.com/file.txt 获得.