Sync fastapi docs from 11614be9 on 2026-03-11
This commit is contained in:
@@ -6,7 +6,7 @@ You can declare a parameter of type `Response` in your *path operation function*
|
||||
|
||||
And then you can set cookies in that *temporal* response object.
|
||||
|
||||
{* ../../docs_src/response_cookies/tutorial002_py39.py hl[1, 8:9] *}
|
||||
{* ../../docs_src/response_cookies/tutorial002_py310.py hl[1, 8:9] *}
|
||||
|
||||
And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
|
||||
|
||||
@@ -20,11 +20,11 @@ You can also declare the `Response` parameter in dependencies, and set cookies (
|
||||
|
||||
You can also create cookies when returning a `Response` directly in your code.
|
||||
|
||||
To do that, you can create a response as described in [Return a Response Directly](response-directly.md){.internal-link target=_blank}.
|
||||
To do that, you can create a response as described in [Return a Response Directly](response-directly.md).
|
||||
|
||||
Then set Cookies in it, and then return it:
|
||||
|
||||
{* ../../docs_src/response_cookies/tutorial001_py39.py hl[10:12] *}
|
||||
{* ../../docs_src/response_cookies/tutorial001_py310.py hl[10:12] *}
|
||||
|
||||
/// tip
|
||||
|
||||
@@ -48,4 +48,4 @@ And as the `Response` can be used frequently to set headers and cookies, **FastA
|
||||
|
||||
///
|
||||
|
||||
To see all the available parameters and options, check the <a href="https://www.starlette.dev/responses/#set-cookie" class="external-link" target="_blank">documentation in Starlette</a>.
|
||||
To see all the available parameters and options, check the [documentation in Starlette](https://www.starlette.dev/responses/#set-cookie).
|
||||
|
||||
Reference in New Issue
Block a user