mirror of https://github.com/tiangolo/fastapi.git
52 lines
1.8 KiB
Markdown
52 lines
1.8 KiB
Markdown
# 📨 🍪
|
||
|
||
## ⚙️ `Response` 🔢
|
||
|
||
👆 💪 📣 🔢 🆎 `Response` 👆 *➡ 🛠️ 🔢*.
|
||
|
||
& ⤴️ 👆 💪 ⚒ 🍪 👈 *🔀* 📨 🎚.
|
||
|
||
{* ../../docs_src/response_cookies/tutorial002.py hl[1,8:9] *}
|
||
|
||
& ⤴️ 👆 💪 📨 🙆 🎚 👆 💪, 👆 🛎 🔜 ( `dict`, 💽 🏷, ♒️).
|
||
|
||
& 🚥 👆 📣 `response_model`, ⚫️ 🔜 ⚙️ ⛽ & 🗜 🎚 👆 📨.
|
||
|
||
**FastAPI** 🔜 ⚙️ 👈 *🔀* 📨 ⚗ 🍪 (🎚 & 👔 📟), & 🔜 🚮 👫 🏁 📨 👈 🔌 💲 👆 📨, ⛽ 🙆 `response_model`.
|
||
|
||
👆 💪 📣 `Response` 🔢 🔗, & ⚒ 🍪 (& 🎚) 👫.
|
||
|
||
## 📨 `Response` 🔗
|
||
|
||
👆 💪 ✍ 🍪 🕐❔ 🛬 `Response` 🔗 👆 📟.
|
||
|
||
👈, 👆 💪 ✍ 📨 🔬 [📨 📨 🔗](response-directly.md){.internal-link target=_blank}.
|
||
|
||
⤴️ ⚒ 🍪 ⚫️, & ⤴️ 📨 ⚫️:
|
||
|
||
{* ../../docs_src/response_cookies/tutorial001.py hl[10:12] *}
|
||
|
||
/// tip
|
||
|
||
✔️ 🤯 👈 🚥 👆 📨 📨 🔗 ↩️ ⚙️ `Response` 🔢, FastAPI 🔜 📨 ⚫️ 🔗.
|
||
|
||
, 👆 🔜 ✔️ ⚒ 💭 👆 💽 ☑ 🆎. 🤶 Ⓜ. ⚫️ 🔗 ⏮️ 🎻, 🚥 👆 🛬 `JSONResponse`.
|
||
|
||
& 👈 👆 🚫 📨 🙆 📊 👈 🔜 ✔️ ⛽ `response_model`.
|
||
|
||
///
|
||
|
||
### 🌅 ℹ
|
||
|
||
/// note | 📡 ℹ
|
||
|
||
👆 💪 ⚙️ `from starlette.responses import Response` ⚖️ `from starlette.responses import JSONResponse`.
|
||
|
||
**FastAPI** 🚚 🎏 `starlette.responses` `fastapi.responses` 🏪 👆, 👩💻. ✋️ 🌅 💪 📨 👟 🔗 ⚪️➡️ 💃.
|
||
|
||
& `Response` 💪 ⚙️ 🛎 ⚒ 🎚 & 🍪, **FastAPI** 🚚 ⚫️ `fastapi.Response`.
|
||
|
||
///
|
||
|
||
👀 🌐 💪 🔢 & 🎛, ✅ <a href="https://www.starlette.dev/responses/#set-cookie" class="external-link" target="_blank">🧾 💃</a>.
|