aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/builtins/test_anticache.py
blob: 512c90f50c51bea662f9050d38cf61eea25f0d5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from .. import tutils, mastertest
from mitmproxy.builtins import anticache
from mitmproxy.flow import master
from mitmproxy import options


class TestAntiCache(mastertest.MasterTest):
    def test_simple(self):
        o = options.Options(anticache = True)
        m = master.FlowMaster(o, None)
        sa = anticache.AntiCache()
        m.addons.add(sa)

        f = tutils.tflow(resp=True)
        m.request(f)

        f = tutils.tflow(resp=True)
        f.request.headers["if-modified-since"] = "test"
        f.request.headers["if-none-match"] = "test"
        m.request(f)
        assert "if-modified-since" not in f.request.headers
        assert "if-none-match" not in f.request.headers