Coverage for docs_src/request_forms_and_files/tutorial001.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-05-05 00:03 +0000

1from fastapi import FastAPI, File, Form, UploadFile 1abcdef

2 

3app = FastAPI() 1abcdef

4 

5 

6@app.post("/files/") 1abcdef

7async def create_file( 1abcdef

8 file: bytes = File(), fileb: UploadFile = File(), token: str = Form() 

9): 

10 return { 1ghijkl

11 "file_size": len(file), 

12 "token": token, 

13 "fileb_content_type": fileb.content_type, 

14 }