diff options
-rw-r--r-- | mitmproxy/flow_export.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mitmproxy/flow_export.py b/mitmproxy/flow_export.py index 49e2d704..6333de57 100644 --- a/mitmproxy/flow_export.py +++ b/mitmproxy/flow_export.py @@ -58,7 +58,9 @@ def python_code(flow): if flow.request.body: json_obj = is_json(flow.request.headers, flow.request.body) if json_obj: - data = json.dumps(json_obj, indent=4) + # Without the separators field json.dumps() produces + # trailing white spaces: https://bugs.python.org/issue16333 + data = json.dumps(json_obj, indent=4, separators=(',', ': ')) data = "\njson = %s\n" % data args += "\n json=json," else: |