fastapi/docs/em/docs/advanced/additional-status-codes.md

1.7 KiB
Raw Blame History

🌖 👔 📟

🔢, FastAPI 🔜 📨 📨 ⚙️ JSONResponse, 🚮 🎚 👆 📨 ➡️ 👆 🛠️ 🔘 👈 JSONResponse.

🔜 ⚙️ 🔢 👔 📟 ⚖️ 1 👆👆 🛠️.

🌖 👔 📟

🚥 👆 💚 📨 🌖 👔 📟 ↖️ ➡️ 👑 1, 👆 💪 👈 🛬 Response 🔗, 💖 JSONResponse, & ⚒ 🌖 👔 📟 🔗.

🖼, ➡️ 💬 👈 👆 💚 ✔️ 🛠️ 👈 🏬, & 📨 🇺🇸🔍 👔 📟 200 "👌" 🕐 🏆.

👆 💚 🚫 🆕 🏬. & 🕐 🏬 🚫 🔀 ⏭, 👫, & 📨 🇺🇸🔍 👔 📟 201 "✍".

🏆 👈, 🗄 JSONResponse, & 📨 👆 🎚 📤 🔗, ⚒ status_code 👈 👆 💚:

{* ../../docs_src/additional_status_codes/tutorial001.py hl[4,25] *}

/// warning

🕐 👆 📨 Response 🔗, 💖 🖼 🔛, 🔜 📨 🔗.

🏆 🚫 🎻 ⏮️ 🏷, .

💭 ✔️ 📊 👆 💚 ✔️, & 👈 💲🎻 (🚥 👆 ⚙️ JSONResponse).

///

/// note | 📡

👆 💪 ⚙️ from starlette.responses import JSONResponse.

FastAPI 🚚 🎏 starlette.responses fastapi.responses 🏪 👆, 👩‍💻. 🌅 💪 📨 👟 🔗 ➡️ 💃. 🎏 ⏮️ status.

///

🗄 & 🛠️ 🩺

🚥 👆 📨 🌖 👔 📟 & 📨 🔗, 👫 🏆 🚫 🔌 🗄 🔗 (🛠️ 🩺), ↩️ FastAPI 🚫 ✔️ 🌌 💭 👆 🚶 📨.

👆 💪 📄 👈 👆 📟, ⚙️: 🌖 📨{.internal-link target=_blank}.