aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordufferzafar <dufferzafar0@gmail.com>2016-07-26 00:58:09 -0700
committerdufferzafar <dufferzafar0@gmail.com>2016-07-27 04:33:16 -0700
commit303b6df447724eb051b65c7e93880a9a90d2b0aa (patch)
tree720625e53a6fb70e4f229fa3ab9257da15d5382a
parentd97fe767dc7b8ea47f0e170c6f002c506f606d57 (diff)
downloadmitmproxy-303b6df447724eb051b65c7e93880a9a90d2b0aa.tar.gz
mitmproxy-303b6df447724eb051b65c7e93880a9a90d2b0aa.tar.bz2
mitmproxy-303b6df447724eb051b65c7e93880a9a90d2b0aa.zip
Use jsbeautifier from pip
-rw-r--r--mitmproxy/contentviews.py4
-rw-r--r--setup.py1
2 files changed, 3 insertions, 2 deletions
diff --git a/mitmproxy/contentviews.py b/mitmproxy/contentviews.py
index e155bc01..3aedf08a 100644
--- a/mitmproxy/contentviews.py
+++ b/mitmproxy/contentviews.py
@@ -31,7 +31,7 @@ from PIL import Image
from six import BytesIO
from mitmproxy import exceptions
-from mitmproxy.contrib import jsbeautifier
+import jsbeautifier
from mitmproxy.contrib.wbxml import ASCommandResponse
from netlib import http
from netlib import multidict
@@ -398,7 +398,7 @@ class ViewJavaScript(View):
def __call__(self, data, **metadata):
opts = jsbeautifier.default_options()
opts.indent_size = 2
- res = jsbeautifier.beautify(data, opts)
+ res = jsbeautifier.beautify(data.decode(), opts)
return "JavaScript", format_text(res)
diff --git a/setup.py b/setup.py
index 23eb3b26..1183d3e1 100644
--- a/setup.py
+++ b/setup.py
@@ -111,6 +111,7 @@ setup(
],
'contentviews': [
"cssutils>=1.0.1, <1.1",
+ "jsbeautifier>=1.6.3"
# TODO: Find Python 3 replacements
# "protobuf>=2.6.1, <2.7",
# "pyamf>=0.8.0, <0.9",