MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_encoding

Function test_encoding

test/mitmproxy/addons/test_core.py:104–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102
103
104def test_encoding():
105 sa = core.Core()
106 with taddons.context(loadcore=False):
107 f = tflow.tflow()
108 assert sa.encode_options()
109 sa.encode([f], "request", "deflate")
110 assert f.request.headers["content-encoding"] == "deflate"
111
112 sa.encode([f], "request", "br")
113 assert f.request.headers["content-encoding"] == "deflate"
114
115 sa.decode([f], "request")
116 assert "content-encoding" not in f.request.headers
117
118 sa.encode([f], "request", "br")
119 assert f.request.headers["content-encoding"] == "br"
120
121 sa.encode_toggle([f], "request")
122 assert "content-encoding" not in f.request.headers
123 sa.encode_toggle([f], "request")
124 assert f.request.headers["content-encoding"] == "deflate"
125 sa.encode_toggle([f], "request")
126 assert "content-encoding" not in f.request.headers
127
128
129def test_options(tmpdir):

Callers

nothing calls this directly

Calls 5

encode_optionsMethod · 0.95
encodeMethod · 0.95
decodeMethod · 0.95
encode_toggleMethod · 0.95
contextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…