File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
files/zh-tw/web/http/reference/status/204 Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 22title : 204 No Content
33slug : Web/HTTP/Reference/Status/204
44l10n :
5- sourceCommit : ad5b5e31f81795d692e66dadb7818ba8b220ad15
5+ sourceCommit : c212cfca9809021001637344831487029f1b8887
66---
77
88HTTP ** ` 204 No Content ` ** [ 成功回應] ( /zh-TW/docs/Web/HTTP/Reference/Status#成功回應 ) 狀態碼表示請求已成功,但用戶端不需要離開當前頁面。` 204 ` 回應預設是可快取的,在這種情況下會包含 {{HTTPHeader("ETag")}} 標頭。
@@ -42,6 +42,31 @@ Date: Wed, 26 Jun 2024 12:00:00 GMT
4242Server: Apache/2.4.1 (Unix)
4343```
4444
45+ ### 使用 PUT 更新後收到回應
46+
47+ 在此範例中,用戶端發送 ` PUT ` 請求來更新使用者的個人資料。該請求包含帶有權杖的 {{HTTPHeader("Authorization")}} 標頭,用以驗證請求:
48+
49+ ``` http
50+ PUT /users/123 HTTP/1.1
51+ Host: example.com
52+ Content-Type: application/json
53+ Authorization: Bearer 1234abcd
54+
55+ {
56+ "name": "Jane Doe",
57+ "email": "jane@example.com"
58+ }
59+ ```
60+
61+ 成功更新使用者個人資料後,伺服器會以 ` 204 ` 回應。{{HTTPHeader("ETag")}} 標頭包含了更新後資源的實體標籤:
62+
63+ ``` http
64+ HTTP/1.1 204 No Content
65+ Date: Wed, 26 Jun 2024 12:00:00 GMT
66+ ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"
67+ Server: Apache/2.4.1 (Unix)
68+ ```
69+
4570## 規範
4671
4772{{Specifications}}
You can’t perform that action at this time.
0 commit comments