MCPcopy
hub / github.com/mitmproxy/mitmproxy / request

Method request

mitmproxy/addons/mapremote.py:58–68  ·  view source on GitHub ↗
(self, flow: http.HTTPFlow)

Source from the content-addressed store, hash-verified

56 self.replacements.append(spec)
57
58 def request(self, flow: http.HTTPFlow) -> None:
59 if flow.response or flow.error or not flow.live:
60 return
61 for spec in self.replacements:
62 if spec.matches(flow):
63 url = flow.request.pretty_url
64 new_url = re.sub(spec.subject, spec.replacement, url)
65 # this is a bit messy: setting .url also updates the host header,
66 # so we really only do that if the replacement affected the URL.
67 if url != new_url:
68 flow.request.url = new_url # type: ignore

Callers 3

test_simpleMethod · 0.95
test_host_headerMethod · 0.95
test_is_killedMethod · 0.95

Calls

no outgoing calls

Tested by 3

test_simpleMethod · 0.76
test_host_headerMethod · 0.76
test_is_killedMethod · 0.76