Make sure the JSON is given back as bytes

This commit is contained in:
Jean-Paul Calderone 2020-10-21 12:27:08 -04:00
parent 444c3e6ce4
commit 62f5fb9d28

View File

@ -1,3 +1,4 @@
from future.utils import PY2
import time, json
from twisted.python.filepath import FilePath
@ -317,4 +318,7 @@ class StorageStatus(MultiFormatResource):
"lease-checker": self._storage.lease_checker.get_state(),
"lease-checker-progress": self._storage.lease_checker.get_progress(),
}
return json.dumps(d, indent=1) + "\n"
result = json.dumps(d, indent=1) + "\n"
if PY2:
result = result.decode("utf-8")
return result.encode("utf-8")