Skip to content

Commit

Permalink
bugfix: fix misconfigured json encoder/decoder, preventing bytes from…
Browse files Browse the repository at this point in the history
… being serialized [VIO-1278]
  • Loading branch information
edaniszewski committed Aug 9, 2021
1 parent 06aaf3c commit e4f6d3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion synse_server/api/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,10 @@ async def response_streamer(response):
# just log it and move on.
try:
async for reading in cmd.read_cache(start, end):
await response.write(ujson.dumps(reading) + '\n')
try:
await response.write(ujson.dumps(reading, reject_bytes=False) + '\n')
except Exception:
logger.exception('error streaming cached reading response', reading=reading)
except Exception:
logger.exception('failure when streaming cached readings')

Expand Down
2 changes: 1 addition & 1 deletion synse_server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _dumps(*arg, **kwargs) -> str:
Returns:
The given dictionary data dumped to a JSON string.
"""
out = ujson.dumps(*arg, **kwargs)
out = ujson.dumps(*arg, reject_bytes=False, **kwargs)
if not out.endswith('\n'):
out += '\n'
return out
Expand Down

0 comments on commit e4f6d3d

Please sign in to comment.