1
0
mirror of synced 2024-11-24 14:30:09 +01:00

cxb: impl JSONResponseNoASCII

This commit is contained in:
Hay1tsme 2024-01-09 12:44:48 -05:00
parent 1c22c6bec0
commit 4bc77a8ef6

View File

@ -1,6 +1,6 @@
from starlette.requests import Request from starlette.requests import Request
from starlette.routing import Route from starlette.routing import Route
from starlette.responses import Response, PlainTextResponse, JSONResponse from starlette.responses import Response, JSONResponse
import traceback import traceback
import sys import sys
import yaml import yaml
@ -13,7 +13,7 @@ from typing import Dict, Tuple, List
from os import path from os import path
from core.config import CoreConfig from core.config import CoreConfig
from core.title import BaseServlet from core.title import BaseServlet, JSONResponseNoASCII
from core.utils import Utils from core.utils import Utils
from .config import CxbConfig from .config import CxbConfig
from .const import CxbConstants from .const import CxbConstants
@ -200,7 +200,7 @@ class CxbServlet(BaseServlet):
return Response() return Response()
self.logger.debug(f"{version_string} Response {resp}") self.logger.debug(f"{version_string} Response {resp}")
return JSONResponse(resp, ensure_ascii=False) return JSONResponseNoASCII(resp)
async def handle_action(self, request: Request) -> bytes: async def handle_action(self, request: Request) -> bytes:
req_json = await self.preprocess(request) req_json = await self.preprocess(request)
@ -229,7 +229,7 @@ class CxbServlet(BaseServlet):
return Response() return Response()
self.logger.debug(f"Response {resp}") self.logger.debug(f"Response {resp}")
return JSONResponse(resp) return JSONResponseNoASCII(resp)
async def handle_auth(self, request: Request) -> bytes: async def handle_auth(self, request: Request) -> bytes:
req_json = await self.preprocess(request) req_json = await self.preprocess(request)
@ -258,4 +258,4 @@ class CxbServlet(BaseServlet):
return Response() return Response()
self.logger.debug(f"Response {resp}") self.logger.debug(f"Response {resp}")
return JSONResponse(resp) return JSONResponseNoASCII(resp)