1
0
forked from Hay1tsme/artemis

add JSONResponseNoASCII

This commit is contained in:
Hay1tsme 2024-01-09 12:41:32 -05:00
parent f65aa4d60a
commit 7b49a8ab58

View File

@ -1,4 +1,5 @@
from typing import Dict, List, Tuple
from typing import Dict, List, Tuple, Any
import json
import logging, coloredlogs
from logging.handlers import TimedRotatingFileHandler
from starlette.requests import Request
@ -9,6 +10,15 @@ from core.config import CoreConfig
from core.data import Data
from core.utils import Utils
class JSONResponseNoASCII(Response):
media_type = "application/json"
def render(self, content: Any) -> bytes:
return json.dumps(
content,
ensure_ascii=False,
).encode("utf-8")
class BaseServlet:
def __init__(self, core_cfg: CoreConfig, cfg_dir: str) -> None:
self.core_cfg = core_cfg