await run_in_threadpool(self.file.close)
-class FormData(ImmutableMultiDict):
+class FormData(ImmutableMultiDict[str, typing.Union[UploadFile, str]]):
"""
An immutable multidict, containing both file uploads and text input.
"""
async def app(scope, receive, send):
request = Request(scope, receive)
data = await request.form()
- output = {}
+ output: typing.Dict[str, typing.Any] = {}
for key, value in data.items():
if isinstance(value, UploadFile):
content = await value.read()
async def app_with_headers(scope, receive, send):
request = Request(scope, receive)
data = await request.form()
- output = {}
+ output: typing.Dict[str, typing.Any] = {}
for key, value in data.items():
if isinstance(value, UploadFile):
content = await value.read()