Encoding fixes and tests

This commit is contained in:
Ujjwal Verma
2017-02-05 18:59:01 +05:30
parent 2316c0fb74
commit c622622c59
3 changed files with 56 additions and 23 deletions

View File

@@ -7,6 +7,7 @@ import json
import sys
import base64
import zlib
import os
from datetime import datetime
import pytz
@@ -166,7 +167,7 @@ def done():
if dump_file.endswith('.zhar'):
raw = zlib.compress(raw, 9)
with open(dump_file, "wb") as f:
with open(os.path.expanduser(dump_file), "wb") as f:
f.write(raw)
mitmproxy.ctx.log("HAR dump finished (wrote %s bytes to file)" % len(json_dump))