Files
fastapi/docs_src/request_form_models/tutorial001.py
Sebastián Ramírez 7bad7c0975 Add support for Pydantic models in Form parameters (#12129)
Revert "️ Temporarily revert " Add support for Pydantic models in `Form` pa…"

This reverts commit 8e6cf9ee9c.
2024-09-05 17:16:50 +02:00

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