MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_simple

Method test_simple

test/mitmproxy/addons/test_modifybody.py:25–43  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

23 assert "Streamed bodies will not be modified" in caplog.text
24
25 def test_simple(self):
26 mb = modifybody.ModifyBody()
27 with taddons.context(mb) as tctx:
28 tctx.configure(
29 mb,
30 modify_body=[
31 "/~q/foo/bar",
32 "/~s/foo/bar",
33 ],
34 )
35 f = tflow.tflow()
36 f.request.content = b"foo"
37 mb.request(f)
38 assert f.request.content == b"bar"
39
40 f = tflow.tflow(resp=True)
41 f.response.content = b"foo"
42 mb.response(f)
43 assert f.response.content == b"bar"
44
45 @pytest.mark.parametrize("take", [True, False])
46 def test_taken(self, take):

Callers

nothing calls this directly

Calls 4

requestMethod · 0.95
responseMethod · 0.95
contextMethod · 0.80
configureMethod · 0.45

Tested by

no test coverage detected