mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-12 09:49:06 -04:00
📝 Simplify example for docs for Additional Responses, remove unnecessary else (#4693)
This commit is contained in:
committed by
GitHub
parent
96c3f44a0e
commit
dde140d8e3
@@ -23,7 +23,7 @@ Each of those response `dict`s can have a key `model`, containing a Pydantic mod
|
||||
|
||||
For example, to declare another response with a status code `404` and a Pydantic model `Message`, you can write:
|
||||
|
||||
```Python hl_lines="18 23"
|
||||
```Python hl_lines="18 22"
|
||||
{!../../../docs_src/additional_responses/tutorial001.py!}
|
||||
```
|
||||
|
||||
|
||||
@@ -19,5 +19,4 @@ app = FastAPI()
|
||||
async def read_item(item_id: str):
|
||||
if item_id == "foo":
|
||||
return {"id": "foo", "value": "there goes my hero"}
|
||||
else:
|
||||
return JSONResponse(status_code=404, content={"message": "Item not found"})
|
||||
return JSONResponse(status_code=404, content={"message": "Item not found"})
|
||||
|
||||
Reference in New Issue
Block a user