fastapi form data with pydantic model
问题 I am trying to submit data from html forms and on the validate it with pydantic model. Using this code from fastapi import FastAPI, Form from pydantic import BaseModel from starlette.responses import HTMLResponse app = FastAPI() @app.get("/form", response_class=HTMLResponse) def form_get(): return '''<form method="post"> <input type="text" name="no" value="1"/> <input type="text" name="nm" value="abcd"/> <input type="submit"/> </form>''' class SimpleModel(BaseModel): no: int nm: str = "" @app