Commit 7d0a83c1 authored by davebshow's avatar davebshow
Browse files

cleaner approach to deserialization

parent 94c776d5
...@@ -43,7 +43,7 @@ class GremlinServerWSProtocol(protocol.AbstractBaseProtocol): ...@@ -43,7 +43,7 @@ class GremlinServerWSProtocol(protocol.AbstractBaseProtocol):
async def data_received(self, data, results_dict): async def data_received(self, data, results_dict):
data = data.decode('utf-8') data = data.decode('utf-8')
message = json.loads(data) message = self._message_serializer.deserialize_message(json.loads(data))
request_id = message['requestId'] request_id = message['requestId']
status_code = message['status']['code'] status_code = message['status']['code']
data = message['result']['data'] data = message['result']['data']
...@@ -65,7 +65,6 @@ class GremlinServerWSProtocol(protocol.AbstractBaseProtocol): ...@@ -65,7 +65,6 @@ class GremlinServerWSProtocol(protocol.AbstractBaseProtocol):
else: else:
if data: if data:
for result in data: for result in data:
result = self._message_serializer.deserialize_message(result)
message = Message(status_code, result, msg) message = Message(status_code, result, msg)
result_set.queue_result(message) result_set.queue_result(message)
else: else:
......
...@@ -38,6 +38,7 @@ class TestDriverRemoteConnection(object): ...@@ -38,6 +38,7 @@ class TestDriverRemoteConnection(object):
statics.load_statics(globals()) statics.load_statics(globals())
g = Graph().traversal().withRemote(remote_connection) g = Graph().traversal().withRemote(remote_connection)
result = await g.V().limit(1).toList() result = await g.V().limit(1).toList()
await remote_connection.close()
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_traversals(self, remote_connection): async def test_traversals(self, remote_connection):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment