]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Add more precise description of HTTP status code range in docs (#13347)
authorHaoyu (Daniel) YANG 杨浩宇 <yanghaoyu97@outlook.com>
Sat, 15 Feb 2025 16:33:33 +0000 (17:33 +0100)
committerGitHub <noreply@github.com>
Sat, 15 Feb 2025 16:33:33 +0000 (17:33 +0100)
docs/en/docs/tutorial/response-status-code.md

index 711042a4667dacf9c81a554c4500f8aefe3b8cdc..41bf02a8f53e637760c7a3a0b9b5adbaaa502e06 100644 (file)
@@ -53,16 +53,16 @@ These status codes have a name associated to recognize them, but the important p
 
 In short:
 
-* `100` and above are for "Information". You rarely use them directly.  Responses with these status codes cannot have a body.
-* **`200`** and above are for "Successful" responses. These are the ones you would use the most.
+* `100 - 199` are for "Information". You rarely use them directly.  Responses with these status codes cannot have a body.
+* **`200 - 299`** are for "Successful" responses. These are the ones you would use the most.
     * `200` is the default status code, which means everything was "OK".
     * Another example would be `201`, "Created". It is commonly used after creating a new record in the database.
     * A special case is `204`, "No Content".  This response is used when there is no content to return to the client, and so the response must not have a body.
-* **`300`** and above are for "Redirection".  Responses with these status codes may or may not have a body, except for `304`, "Not Modified", which must not have one.
-* **`400`** and above are for "Client error" responses. These are the second type you would probably use the most.
+* **`300 - 399`** are for "Redirection".  Responses with these status codes may or may not have a body, except for `304`, "Not Modified", which must not have one.
+* **`400 - 499`** are for "Client error" responses. These are the second type you would probably use the most.
     * An example is `404`, for a "Not Found" response.
     * For generic errors from the client, you can just use `400`.
-* `500` and above are for server errors. You almost never use them directly. When something goes wrong at some part in your application code, or server, it will automatically return one of these status codes.
+* `500 - 599` are for server errors. You almost never use them directly. When something goes wrong at some part in your application code, or server, it will automatically return one of these status codes.
 
 /// tip