aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/addons/test_anticomp.py
blob: 92650332c78037673577a76ed349b9803a97c65f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from mitmproxy.test import tflow

from mitmproxy.addons import anticomp
from mitmproxy.test import taddons


class TestAntiComp:
    def test_simple(self):
        sa = anticomp.AntiComp()
        with taddons.context(sa) as tctx:
            f = tflow.tflow(resp=True)
            sa.request(f)

            tctx.configure(sa, anticomp=True)
            f = tflow.tflow(resp=True)

            f.request.headers["Accept-Encoding"] = "foobar"
            sa.request(f)
            assert f.request.headers["Accept-Encoding"] == "identity"