async def handle(self, request): request = await request.text() self.logger.info(f'{request}') response = await jsonrpcserver.async_dispatch(request, methods=self.methods) if response.wanted: return web.json_response(response.deserialized(), status=response.http_status) else: return web.Response()
async def handle(self, request): try: self.authenticate(request.headers) except AuthenticationError: return web.Response(text='Forbidden', status=403) request = await request.text() #self.logger.info(f'handling request: {request}') response = await jsonrpcserver.async_dispatch(request, methods=self.methods) if isinstance(response, jsonrpcserver.response.ExceptionResponse): self.logger.error(f"error handling request: {request}", exc_info=response.exc) if response.wanted: return web.json_response(response.deserialized(), status=response.http_status) else: return web.Response()
async def handle(self, request): async with self.auth_lock: try: await self.authenticate(request.headers) except AuthenticationError: return web.Response(text='Forbidden', status=403) request = await request.text() response = await jsonrpcserver.async_dispatch(request, methods=self.methods) if isinstance(response, jsonrpcserver.response.ExceptionResponse): self.logger.error(f"error handling request: {request}", exc_info=response.exc) # this exposes the error message to the client response.message = str(response.exc) if response.wanted: return web.json_response(response.deserialized(), status=response.http_status) else: return web.Response()