diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-08-01 10:41:12 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-08-01 10:43:01 +1200 |
commit | ddb5748a76725ea6a6c6bb58e13b7b8ca09e147b (patch) | |
tree | 8d2893120e65b7c9433a670b0719243621e56a61 /test/test_proxy.py | |
parent | c89c4361c376765c666cc6ed0ab5834b2418082d (diff) | |
download | mitmproxy-ddb5748a76725ea6a6c6bb58e13b7b8ca09e147b.tar.gz mitmproxy-ddb5748a76725ea6a6c6bb58e13b7b8ca09e147b.tar.bz2 mitmproxy-ddb5748a76725ea6a6c6bb58e13b7b8ca09e147b.zip |
Add decoding/encoding for requests.
Diffstat (limited to 'test/test_proxy.py')
-rw-r--r-- | test/test_proxy.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py index 1e68fd3d..340a68d7 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -138,6 +138,31 @@ class uRequest(libpry.AutoTree): assert not "foo" in r.content assert r.headers["boo"] == ["boo"] + def test_decodeencode(self): + r = tutils.treq() + r.headers["content-encoding"] = ["identity"] + r.content = "falafel" + r.decode() + assert r.headers["content-encoding"] == ["identity"] + assert r.content == "falafel" + + r = tutils.treq() + r.headers["content-encoding"] = ["identity"] + r.content = "falafel" + r.encode("identity") + assert r.headers["content-encoding"] == ["identity"] + assert r.content == "falafel" + + r = tutils.treq() + r.headers["content-encoding"] = ["identity"] + r.content = "falafel" + r.encode("gzip") + assert r.headers["content-encoding"] == ["gzip"] + assert r.content != "falafel" + r.decode() + assert r.headers["content-encoding"] == ["identity"] + assert r.content == "falafel" + class uResponse(libpry.AutoTree): def test_simple(self): |