Beautify JSON responses
This commit is contained in:
@@ -7,6 +7,7 @@ import copy
|
|||||||
import fnmatch
|
import fnmatch
|
||||||
import gzip
|
import gzip
|
||||||
import io
|
import io
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import pickle
|
import pickle
|
||||||
import re
|
import re
|
||||||
@@ -507,6 +508,8 @@ class HTTPMessageLogEntry(AbstractMessageLogEntry):
|
|||||||
raise
|
raise
|
||||||
elif any(content_type.startswith(x) for x in ("application/xml", "text/xml")):
|
elif any(content_type.startswith(x) for x in ("application/xml", "text/xml")):
|
||||||
beautified = self._format_xml(message.content)
|
beautified = self._format_xml(message.content)
|
||||||
|
elif "json" in content_type:
|
||||||
|
beautified = json.dumps(json.loads(message.content), indent=2)
|
||||||
except:
|
except:
|
||||||
LOG.exception("Failed to beautify message")
|
LOG.exception("Failed to beautify message")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user