mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-24 18:54:11 +08:00
Revert "⏪️ Temporarily revert "✨ Add support for Pydantic models in `Form` pa…"
This reverts commit 8e6cf9ee9c.
16 lines
278 B
Python
16 lines
278 B
Python
from fastapi import FastAPI, Form
|
|
from pydantic import BaseModel
|
|
from typing_extensions import Annotated
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class FormData(BaseModel):
|
|
username: str
|
|
password: str
|
|
|
|
|
|
@app.post("/login/")
|
|
async def login(data: Annotated[FormData, Form()]):
|
|
return data
|