Remove plain json serializer implementation
This commit is contained in:
parent
867d59b930
commit
b6434040de
@ -1,4 +1,3 @@
|
|||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
@ -38,14 +37,6 @@ class WebSocketSerializer(ABC):
|
|||||||
await self._websocket.close(code)
|
await self._websocket.close(code)
|
||||||
|
|
||||||
|
|
||||||
class JSONWebSocketSerializer(WebSocketSerializer):
|
|
||||||
def _serialize(self, data):
|
|
||||||
return json.dumps(data, default=_json_default)
|
|
||||||
|
|
||||||
def _deserialize(self, data):
|
|
||||||
return json.loads(data, object_hook=_json_object_hook)
|
|
||||||
|
|
||||||
|
|
||||||
class HybridJSONWebSocketSerializer(WebSocketSerializer):
|
class HybridJSONWebSocketSerializer(WebSocketSerializer):
|
||||||
def _serialize(self, data) -> str:
|
def _serialize(self, data) -> str:
|
||||||
return str(orjson.dumps(data, default=_json_default), "utf-8")
|
return str(orjson.dumps(data, default=_json_default), "utf-8")
|
||||||
|
Loading…
Reference in New Issue
Block a user