From: Alex Wendland Date: Sat, 9 Nov 2024 12:24:09 +0000 (+0000) Subject: ๐Ÿ“ Update includes in `docs/en/docs/tutorial/middleware.md` (#12807) X-Git-Tag: 0.115.5~99 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0a8f00b41490cd7c54029036a6f2fbd49f78751;p=thirdparty%2Ffastapi%2Ffastapi.git ๐Ÿ“ Update includes in `docs/en/docs/tutorial/middleware.md` (#12807) --- diff --git a/docs/en/docs/tutorial/middleware.md b/docs/en/docs/tutorial/middleware.md index 7c4954c7b7..16d853018d 100644 --- a/docs/en/docs/tutorial/middleware.md +++ b/docs/en/docs/tutorial/middleware.md @@ -31,9 +31,7 @@ The middleware function receives: * Then it returns the `response` generated by the corresponding *path operation*. * You can then further modify the `response` before returning it. -```Python hl_lines="8-9 11 14" -{!../../docs_src/middleware/tutorial001.py!} -``` +{* ../../docs_src/middleware/tutorial001.py hl[8:9,11,14] *} /// tip @@ -59,11 +57,10 @@ And also after the `response` is generated, before returning it. For example, you could add a custom header `X-Process-Time` containing the time in seconds that it took to process the request and generate a response: -```Python hl_lines="10 12-13" -{!../../docs_src/middleware/tutorial001.py!} -``` +{* ../../docs_src/middleware/tutorial001.py hl[10,12:13] *} /// tip +```Python hl_lines="10 12-13" Here we use `time.perf_counter()` instead of `time.time()` because it can be more precise for these use cases. รฐยŸยคย“