Sync fastapi docs from 11614be9 on 2026-03-11
This commit is contained in:
@@ -15,7 +15,7 @@ But there are situations where you might need to access the `Request` object dir
|
||||
|
||||
## Details about the `Request` object { #details-about-the-request-object }
|
||||
|
||||
As **FastAPI** is actually **Starlette** underneath, with a layer of several tools on top, you can use Starlette's <a href="https://www.starlette.dev/requests/" class="external-link" target="_blank">`Request`</a> object directly when you need to.
|
||||
As **FastAPI** is actually **Starlette** underneath, with a layer of several tools on top, you can use Starlette's [`Request`](https://www.starlette.dev/requests/) object directly when you need to.
|
||||
|
||||
It would also mean that if you get data from the `Request` object directly (for example, read the body) it won't be validated, converted or documented (with OpenAPI, for the automatic API user interface) by FastAPI.
|
||||
|
||||
@@ -29,7 +29,7 @@ Let's imagine you want to get the client's IP address/host inside of your *path
|
||||
|
||||
For that you need to access the request directly.
|
||||
|
||||
{* ../../docs_src/using_request_directly/tutorial001_py39.py hl[1,7:8] *}
|
||||
{* ../../docs_src/using_request_directly/tutorial001_py310.py hl[1,7:8] *}
|
||||
|
||||
By declaring a *path operation function* parameter with the type being the `Request` **FastAPI** will know to pass the `Request` in that parameter.
|
||||
|
||||
@@ -45,7 +45,7 @@ The same way, you can declare any other parameter as normally, and additionally,
|
||||
|
||||
## `Request` documentation { #request-documentation }
|
||||
|
||||
You can read more details about the <a href="https://www.starlette.dev/requests/" class="external-link" target="_blank">`Request` object in the official Starlette documentation site</a>.
|
||||
You can read more details about the [`Request` object in the official Starlette documentation site](https://www.starlette.dev/requests/).
|
||||
|
||||
/// note | Technical Details
|
||||
|
||||
|
||||
Reference in New Issue
Block a user