mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Also replace strings path for requests.
This commit is contained in:
parent
6ce8b49e05
commit
47e1695512
@ -920,7 +920,6 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
|
||||
self.debug = options.debug
|
||||
|
||||
|
||||
def _runscript(self, f, path):
|
||||
path = os.path.expanduser(path)
|
||||
self.state.last_script = path
|
||||
|
@ -287,6 +287,8 @@ class Request(controller.Msg):
|
||||
made.
|
||||
"""
|
||||
self.content, c = re.subn(pattern, repl, self.content, count, flags)
|
||||
self.path, pc = re.subn(pattern, repl, self.path, count, flags)
|
||||
c += pc
|
||||
c += self.headers.replace(pattern, repl, count, flags)
|
||||
return c
|
||||
|
||||
|
@ -130,9 +130,11 @@ class uRequest(libpry.AutoTree):
|
||||
|
||||
def test_replace(self):
|
||||
r = tutils.treq()
|
||||
r.path = "path/foo"
|
||||
r.headers["Foo"] = ["fOo"]
|
||||
r.content = "afoob"
|
||||
assert r.replace("foo", "boo", flags=re.I) == 3
|
||||
assert r.replace("foo", "boo", flags=re.I) == 4
|
||||
assert r.path == "path/boo"
|
||||
assert not "foo" in r.content
|
||||
assert r.headers["boo"] == ["boo"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user