mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-25 07:08:11 -05:00
Revert "⏪️ Temporarily revert "✨ Add support for Pydantic models in `Form` pa…"
This reverts commit 8e6cf9ee9c.
15 lines
228 B
Python
15 lines
228 B
Python
from fastapi import FastAPI, Form
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class FormData(BaseModel):
|
|
username: str
|
|
password: str
|
|
|
|
|
|
@app.post("/login/")
|
|
async def login(data: FormData = Form()):
|
|
return data
|