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

Function reply_next_layer

test/mitmproxy/proxy/tutils.py:456–467  ·  view source on GitHub ↗

Helper function to simplify the syntax for next_layer events to this: << NextLayerHook(nl) >> reply_next_layer(tutils.EchoLayer)

(
    child_layer: type[Layer] | Callable[[context.Context], Layer], *args, **kwargs
)

Source from the content-addressed store, hash-verified

454
455
456def reply_next_layer(
457 child_layer: type[Layer] | Callable[[context.Context], Layer], *args, **kwargs
458) -> reply:
459 """Helper function to simplify the syntax for next_layer events to this:
460 << NextLayerHook(nl)
461 >> reply_next_layer(tutils.EchoLayer)
462 """
463
464 def set_layer(next_layer: layer.NextLayer) -> None:
465 next_layer.layer = child_layer(next_layer.context)
466
467 return reply(*args, side_effect=set_layer, **kwargs)

Callers 14

test_upstream_httpsFunction · 0.90
test_reverse_proxyFunction · 0.90
test_reverse_dnsFunction · 0.90
test_quicFunction · 0.90
test_udpFunction · 0.90
test_transparent_tcpFunction · 0.90
test_https_proxyFunction · 0.90
test_redirectFunction · 0.90
test_upstream_proxyFunction · 0.90
test_http_proxy_tcpFunction · 0.90

Calls 1

replyClass · 0.85

Tested by 14

test_upstream_httpsFunction · 0.72
test_reverse_proxyFunction · 0.72
test_reverse_dnsFunction · 0.72
test_quicFunction · 0.72
test_udpFunction · 0.72
test_transparent_tcpFunction · 0.72
test_https_proxyFunction · 0.72
test_redirectFunction · 0.72
test_upstream_proxyFunction · 0.72
test_http_proxy_tcpFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…