(request)
| 124 | stop_signal: Optional[asyncio.Queue] = None |
| 125 | |
| 126 | async def handle_request(request): |
| 127 | command = request.match_info["cmd"] |
| 128 | request_key = request.headers["HQ_TEST_KEY"] |
| 129 | assert request_key == key |
| 130 | |
| 131 | logging.info(f"Received request: {request}, command: {command}") |
| 132 | input = await extract_mock_input(request, command) |
| 133 | try: |
| 134 | resp = await handler.handle_command(input) |
| 135 | except ManagerException as e: |
| 136 | # This exception should not be propagated within tests, and should be returned |
| 137 | # in stderr of the manager response instead. |
| 138 | resp = response_error(stderr=str(e)) |
| 139 | assert isinstance(resp, CommandOutput) |
| 140 | |
| 141 | resp = { |
| 142 | "stdout": resp.stdout, |
| 143 | "stderr": resp.stderr, |
| 144 | "code": resp.code, |
| 145 | } |
| 146 | return web.json_response(resp) |
| 147 | |
| 148 | @web.middleware |
| 149 | async def handle_error(request, handler): |
nothing calls this directly
no test coverage detected