]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Simplify example for docs for Additional Responses, remove unnecessary `else` ...
authorAdrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
Fri, 26 Aug 2022 13:32:30 +0000 (08:32 -0500)
committerGitHub <noreply@github.com>
Fri, 26 Aug 2022 13:32:30 +0000 (15:32 +0200)
docs/en/docs/advanced/additional-responses.md
docs_src/additional_responses/tutorial001.py

index 5d136da41b02c85caef72843c703a0ccc139f5f1..dca5f6a985cc1b312d7212a76e760ed784e055c0 100644 (file)
@@ -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!}
 ```
 
index 79dcc2efee601812112ec6e3b6ce37f514f1226b..ffa821b910a8445d005d6ef647addb3c2800188c 100644 (file)
@@ -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"})