Skip to content

Commit b4e920c

Browse files
authored
doc: fix example of content-length to correct value (mdn#43361)
1 parent 73ca80b commit b4e920c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

files/en-us/web/http/reference/headers/content-type/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ When forms don't involve file uploads and are using simpler fields, URL-encoded
153153
POST /submit HTTP/1.1
154154
Host: example.com
155155
Content-Type: application/x-www-form-urlencoded
156-
Content-Length: 15
156+
Content-Length: 16
157157
158-
comment=Hello!
158+
comment=Hello%21
159159
```
160160

161161
### `Content-Type` in a REST API using JSON

files/en-us/web/http/reference/status/205/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ The instruction to "reset content" can mean clearing the contents of a form, res
1515
> In web applications that use the `205` status, it's assumed that the client handles resetting content after a `205` response.
1616
> This is typically done via JavaScript, as resetting content such as forms after a `205` response is not handled natively by browsers.
1717
18-
Note that the response must not include any content or the {{HTTPHeader("Content-Length")}} header (browsers may reject responses that include content).
18+
Note that the response must not include any content, and browsers may reject responses that do so.
19+
The response should not include the {{HTTPHeader("Content-Length")}} header either, but if it does the value must be `0`.
1920
The empty response may also be indicated using the {{HTTPHeader("Transfer-Encoding", "Transfer-Encoding: chunked")}} header with an empty chunk.
2021

2122
## Status
@@ -34,17 +35,16 @@ The client in this example sends a `POST` request to submit a form with the comm
3435
POST /submit HTTP/1.1
3536
Host: example.com
3637
Content-Type: application/x-www-form-urlencoded
37-
Content-Length: 15
38+
Content-Length: 16
3839
39-
comment=Hello!
40+
comment=Hello%21
4041
```
4142

4243
After successfully processing the form submission, the server responds with the following `205` response, indicating that the client should reset the form.
4344

4445
```http
4546
HTTP/1.1 205 Reset Content
4647
Content-Type: text/html; charset=utf-8
47-
Content-Length: 0
4848
Date: Wed, 26 Jun 2024 12:00:00 GMT
4949
```
5050

0 commit comments

Comments
 (0)