Also replace strings path for requests.

This commit is contained in:
Aldo Cortesi 2011-07-22 20:52:13 +12:00
parent 6ce8b49e05
commit 47e1695512
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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"]