mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Fix issue with binary content in json
This commit is contained in:
parent
4f1fb43dcc
commit
bf4425de80
@ -130,10 +130,11 @@ def response(flow):
|
|||||||
|
|
||||||
# Store binay data as base64
|
# Store binay data as base64
|
||||||
if strutils.is_mostly_bin(flow.response.content):
|
if strutils.is_mostly_bin(flow.response.content):
|
||||||
entry["response"]["content"]["text"] = base64.b64encode(flow.response.content)
|
b64 = base64.b64encode(flow.response.content)
|
||||||
|
entry["response"]["content"]["text"] = b64.decode('ascii')
|
||||||
entry["response"]["content"]["encoding"] = "base64"
|
entry["response"]["content"]["encoding"] = "base64"
|
||||||
else:
|
else:
|
||||||
entry["response"]["content"]["text"] = flow.response.content
|
entry["response"]["content"]["text"] = flow.response.text
|
||||||
|
|
||||||
if flow.request.method in ["POST", "PUT", "PATCH"]:
|
if flow.request.method in ["POST", "PUT", "PATCH"]:
|
||||||
entry["request"]["postData"] = {
|
entry["request"]["postData"] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user