Coverage for docs_src / request_form_models / tutorial001_an_py310.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1from typing import Annotated 1abghcdef

2 

3from fastapi import FastAPI, Form 1abghcdef

4from pydantic import BaseModel 1abghcdef

5 

6app = FastAPI() 1abghcdef

7 

8 

9class FormData(BaseModel): 1abghcdef

10 username: str 1abcdef

11 password: str 1abcdef

12 

13 

14@app.post("/login/") 1abghcdef

15async def login(data: Annotated[FormData, Form()]): 1abghcdef

16 return data 1ijkl