MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / test_inject_message

Function test_inject_message

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

Source from the content-addressed store, hash-verified

470
471
472def test_inject_message(ws_testdata):
473 tctx, playbook, flow = ws_testdata
474 assert (
475 playbook
476 << websocket.WebsocketStartHook(flow)
477 >> reply()
478 >> WebSocketMessageInjected(
479 flow, WebSocketMessage(Opcode.TEXT, False, b"hello")
480 )
481 << websocket.WebsocketMessageHook(flow)
482 )
483 assert flow.websocket.messages[-1].content == b"hello"
484 assert flow.websocket.messages[-1].from_client is False
485 assert flow.websocket.messages[-1].injected is True
486 assert playbook >> reply() << SendData(tctx.client, b"\x81\x05hello")

Callers

nothing calls this directly

Calls 4

replyClass · 0.90
WebSocketMessageClass · 0.90
SendDataClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…