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

Method configure

mitmproxy/addons/modifybody.py:30–53  ·  view source on GitHub ↗
(self, updated)

Source from the content-addressed store, hash-verified

28 )
29
30 def configure(self, updated):
31 if "modify_body" in updated:
32 self.replacements = []
33 for option in ctx.options.modify_body:
34 try:
35 spec = parse_modify_spec(option, True)
36 except ValueError as e:
37 raise exceptions.OptionsError(
38 f"Cannot parse modify_body option {option}: {e}"
39 ) from e
40
41 self.replacements.append(spec)
42
43 stream_and_modify_conflict = (
44 ctx.options.modify_body
45 and ctx.options.stream_large_bodies
46 and ("modify_body" in updated or "stream_large_bodies" in updated)
47 )
48 if stream_and_modify_conflict:
49 logger.log(
50 ALERT,
51 "Both modify_body and stream_large_bodies are active. "
52 "Streamed bodies will not be modified.",
53 )
54
55 def request(self, flow):
56 if flow.response or flow.error or not flow.live:

Callers

nothing calls this directly

Calls 3

parse_modify_specFunction · 0.90
appendMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected