Skip to content

Commit 512bf4e

Browse files
authored
[zh-TW]: update HTTP Status 204 (#33010)
1 parent ce18b28 commit 512bf4e

File tree

1 file changed

+26
-1
lines changed
  • files/zh-tw/web/http/reference/status/204

1 file changed

+26
-1
lines changed

files/zh-tw/web/http/reference/status/204/index.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 204 No Content
33
slug: Web/HTTP/Reference/Status/204
44
l10n:
5-
sourceCommit: ad5b5e31f81795d692e66dadb7818ba8b220ad15
5+
sourceCommit: c212cfca9809021001637344831487029f1b8887
66
---
77

88
HTTP **`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
4242
Server: 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}}

0 commit comments

Comments
 (0)