Conditions | 3 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import json |
||
16 | async def handle_http_request(self, http_request: web.Request) -> web.Response: |
||
17 | if http_request.method != 'POST': |
||
18 | raise web.HTTPMethodNotAllowed(method=http_request.method, allowed_methods=('POST',)) |
||
19 | |||
20 | try: |
||
21 | input_data = await http_request.json() |
||
22 | except json.JSONDecodeError as e: |
||
23 | response = protocol.JsonRpcResponse(error=errors.ParseError(utils.get_exc_message(e))) |
||
24 | return web.json_response(response.dump(), dumps=self.json_serialize) |
||
25 | |||
26 | output_data = await self._process_input_data(input_data, context={'http_request': http_request}) |
||
27 | |||
28 | return web.json_response(output_data, dumps=self.json_serialize) |
||
29 | |||
34 |