diff --git a/mitmproxy/addons/replace.py b/mitmproxy/addons/replace.py index a653bd701..012c42bd0 100644 --- a/mitmproxy/addons/replace.py +++ b/mitmproxy/addons/replace.py @@ -59,6 +59,7 @@ class _ReplaceBase: lst = [] for rep in getattr(options, self.optionName): fpatt, rex, s = parse_hook(rep) + flt = flowfilter.parse(fpatt) if not flt: raise exceptions.OptionsError( diff --git a/mitmproxy/options.py b/mitmproxy/options.py index 462752c43..088d52c20 100644 --- a/mitmproxy/options.py +++ b/mitmproxy/options.py @@ -120,7 +120,6 @@ class Options(optmanager.OptManager): the separator can be any character. """ ) - self.add_option( "server_replay_use_headers", Sequence[str], [], "Request headers to be considered during replay." diff --git a/test/mitmproxy/addons/test_replace.py b/test/mitmproxy/addons/test_replace.py index 8c280c51c..79ef7baca 100644 --- a/test/mitmproxy/addons/test_replace.py +++ b/test/mitmproxy/addons/test_replace.py @@ -72,7 +72,7 @@ class TestUpstreamProxy(tservers.HTTPUpstreamProxyTest): class TestReplaceFile: def test_simple(self): - r = replace.ReplaceFile() + r = replace.Replace() with tutils.tmpdir() as td: rp = os.path.join(td, "replacement") with open(rp, "w") as f: @@ -80,10 +80,10 @@ class TestReplaceFile: with taddons.context() as tctx: tctx.configure( r, - replacement_files = [ - "/~q/foo/" + rp, - "/~s/foo/" + rp, - "/~b nonexistent/nonexistent/nonexistent", + replacements = [ + "/~q/foo/@" + rp, + "/~s/foo/@" + rp, + "/~b nonexistent/nonexistent/@nonexistent", ] ) f = tflow.tflow()