MCPcopy
hub / github.com/encode/starlette / app

Function app

tests/test_formparsers.py:34–51  ·  tests/test_formparsers.py::app
(scope: Scope, receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

32
33
34async def app(scope: Scope, receive: Receive, send: Send) -> None:
35 request = Request(scope, receive)
36 data = await request.form()
37 output: dict[str, Any] = {}
38 for key, value in data.items():
39 if isinstance(value, UploadFile):
40 content = await value.read()
41 output[key] = {
42 class="st">"filename": value.filename,
43 class="st">"size": value.size,
44 class="st">"content": content.decode(),
45 class="st">"content_type": value.content_type,
46 }
47 else:
48 output[key] = value
49 await request.close()
50 response = JSONResponse(output)
51 await response(scope, receive, send)
52
53
54async def multi_items_app(scope: Scope, receive: Receive, send: Send) -> None:

Callers

nothing calls this directly

Calls 7

formMethod · 0.95
closeMethod · 0.95
RequestClass · 0.90
JSONResponseClass · 0.90
readMethod · 0.80
decodeMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected