MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_modify_message

Function test_modify_message

test/mitmproxy/proxy/layers/test_websocket.py:227–241  ·  view source on GitHub ↗
(ws_testdata)

Source from the content-addressed store, hash-verified

225
226
227def test_modify_message(ws_testdata):
228 tctx, playbook, flow = ws_testdata
229 assert (
230 playbook
231 << websocket.WebsocketStartHook(flow)
232 >> reply()
233 >> DataReceived(tctx.server, b"\x81\x03foo")
234 << websocket.WebsocketMessageHook(flow)
235 )
236 flow.websocket.messages[-1].content = flow.websocket.messages[-1].content.replace(
237 b"foo", b"foobar"
238 )
239 playbook >> reply()
240 playbook << SendData(tctx.client, b"\x81\x06foobar")
241 assert playbook
242
243
244def test_empty_message(ws_testdata):

Callers

nothing calls this directly

Calls 4

replyClass · 0.90
DataReceivedClass · 0.90
SendDataClass · 0.90
replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…