(scope: Scope, receive: Receive, send: Send)
| 52 | |
| 53 | |
| 54 | async def multi_items_app(scope: Scope, receive: Receive, send: Send) -> None: |
| 55 | request = Request(scope, receive) |
| 56 | data = await request.form() |
| 57 | output: dict[str, list[Any]] = {} |
| 58 | for key, value in data.multi_items(): |
| 59 | if key not in output: |
| 60 | output[key] = [] |
| 61 | if isinstance(value, UploadFile): |
| 62 | content = await value.read() |
| 63 | output[key].append( |
| 64 | { |
| 65 | "filename": value.filename, |
| 66 | "size": value.size, |
| 67 | "content": content.decode(), |
| 68 | "content_type": value.content_type, |
| 69 | } |
| 70 | ) |
| 71 | else: |
| 72 | output[key].append(value) |
| 73 | await request.close() |
| 74 | response = JSONResponse(output) |
| 75 | await response(scope, receive, send) |
| 76 | |
| 77 | |
| 78 | async def app_with_headers(scope: Scope, receive: Receive, send: Send) -> None: |
nothing calls this directly
no test coverage detected