mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-07 02:28:50 +00:00
Fixed Replacement test
This commit is contained in:
parent
07a8c4987a
commit
25703f8c53
@ -59,6 +59,7 @@ class _ReplaceBase:
|
|||||||
lst = []
|
lst = []
|
||||||
for rep in getattr(options, self.optionName):
|
for rep in getattr(options, self.optionName):
|
||||||
fpatt, rex, s = parse_hook(rep)
|
fpatt, rex, s = parse_hook(rep)
|
||||||
|
|
||||||
flt = flowfilter.parse(fpatt)
|
flt = flowfilter.parse(fpatt)
|
||||||
if not flt:
|
if not flt:
|
||||||
raise exceptions.OptionsError(
|
raise exceptions.OptionsError(
|
||||||
|
@ -120,7 +120,6 @@ class Options(optmanager.OptManager):
|
|||||||
the separator can be any character.
|
the separator can be any character.
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
self.add_option(
|
self.add_option(
|
||||||
"server_replay_use_headers", Sequence[str], [],
|
"server_replay_use_headers", Sequence[str], [],
|
||||||
"Request headers to be considered during replay."
|
"Request headers to be considered during replay."
|
||||||
|
@ -72,7 +72,7 @@ class TestUpstreamProxy(tservers.HTTPUpstreamProxyTest):
|
|||||||
|
|
||||||
class TestReplaceFile:
|
class TestReplaceFile:
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
r = replace.ReplaceFile()
|
r = replace.Replace()
|
||||||
with tutils.tmpdir() as td:
|
with tutils.tmpdir() as td:
|
||||||
rp = os.path.join(td, "replacement")
|
rp = os.path.join(td, "replacement")
|
||||||
with open(rp, "w") as f:
|
with open(rp, "w") as f:
|
||||||
@ -80,10 +80,10 @@ class TestReplaceFile:
|
|||||||
with taddons.context() as tctx:
|
with taddons.context() as tctx:
|
||||||
tctx.configure(
|
tctx.configure(
|
||||||
r,
|
r,
|
||||||
replacement_files = [
|
replacements = [
|
||||||
"/~q/foo/" + rp,
|
"/~q/foo/@" + rp,
|
||||||
"/~s/foo/" + rp,
|
"/~s/foo/@" + rp,
|
||||||
"/~b nonexistent/nonexistent/nonexistent",
|
"/~b nonexistent/nonexistent/@nonexistent",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
f = tflow.tflow()
|
f = tflow.tflow()
|
||||||
|
Loading…
Reference in New Issue
Block a user