Build and run the ASGI instance. Receives the application and any body included in the request, then builds the ASGI instance using the connection scope. Runs until the response is completely read from the application.
(self, app: Any, body: bytes)
| 1386 | self.response: dict[str, Any] = {} |
| 1387 | |
| 1388 | def __call__(self, app: Any, body: bytes) -> dict[str, Any]: |
| 1389 | """Build and run the ASGI instance. |
| 1390 | |
| 1391 | Receives the application and any body |
| 1392 | included in the request, then builds the |
| 1393 | ASGI instance using the connection scope. |
| 1394 | Runs until the response is completely read |
| 1395 | from the application. |
| 1396 | """ |
| 1397 | self.app_queue = asyncio.Queue() |
| 1398 | self.put_message( |
| 1399 | { |
| 1400 | "type": "http.request", |
| 1401 | "body": body, |
| 1402 | "more_body": False, |
| 1403 | } |
| 1404 | ) |
| 1405 | |
| 1406 | asgi_instance = app(self.scope, self.receive, self.send) |
| 1407 | _asgi_runner.run(asgi_instance) |
| 1408 | return self.response |
| 1409 | |
| 1410 | def put_message(self, message: dict[str, Any]) -> None: |
| 1411 | self.app_queue.put_nowait(message) |
nothing calls this directly
no test coverage detected