diff --git a/README.md b/README.md index a42cedae6..00dc4df61 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ FastAPI

- FastAPI framework, high performance, easy to learn, fast to code, ready for production + FastAPI framework: high performance, easy to learn, fast to code, and ready for production

@@ -126,7 +126,9 @@ The key features are: If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**. -**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀 +**Typer** is FastAPI's little sibling, intended to be the **FastAPI of CLIs**. + +🚀 ## Requirements @@ -178,7 +180,11 @@ def read_item(item_id: int, q: Union[str, None] = None):

Or use async def... -If your code uses `async` / `await`, use `async def`: +!!! tip + Use `async def` only when your code performs non-blocking I/O, + such as database queries or external API calls. + + ```Python hl_lines="9 14" from typing import Union diff --git a/docs/en/docs/index.md b/docs/en/docs/index.md index a0a5de3b7..a9729f91c 100644 --- a/docs/en/docs/index.md +++ b/docs/en/docs/index.md @@ -8,7 +8,7 @@ FastAPI

- FastAPI framework, high performance, easy to learn, fast to code, ready for production + FastAPI framework: high performance, easy to learn, fast to code, and ready for production

@@ -123,7 +123,9 @@ The key features are: If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**. -**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀 +**Typer** is FastAPI's little sibling, intended to be the **FastAPI of CLIs**. + +🚀 ## Requirements { #requirements } @@ -175,7 +177,10 @@ def read_item(item_id: int, q: Union[str, None] = None):

Or use async def... -If your code uses `async` / `await`, use `async def`: +!!! tip + To learn more about when to use `async def`, check the Async and await documentation. + + ```Python hl_lines="9 14" from typing import Union diff --git a/fastapi/routing.py b/fastapi/routing.py index 9be2b44bc..c476a2bf6 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -407,7 +407,7 @@ def get_request_handler( raise except Exception as e: http_error = HTTPException( - status_code=400, detail="There was an error parsing the body" + status_code=400, detail="An error occurred while parsing the body" ) raise http_error from e