Open JSON file in text mode

This commit is contained in:
Shadab Zafar 2016-08-08 14:33:21 +05:30
parent 2c9240fd22
commit 456f80d862
2 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ def done():
mitmproxy.ctx.log(pprint.pformat(HAR))
# TODO: .zhar compression
else:
with open(dump_file, "wb") as f:
with open(dump_file, "w") as f:
f.write(json.dumps(HAR, indent=2))
# TODO: Log results via mitmproxy.ctx.log

View File

@ -128,7 +128,7 @@ class TestHARDump(mastertest.MasterTest):
self.invoke(m, "response", self.req_get)
m.addons.remove(sc)
with open(path, "rb") as inp:
with open(path, "r") as inp:
har = json.load(inp)
assert len(har["log"]["entries"]) == 1