mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
fix #876
This commit is contained in:
parent
b0477fd8c9
commit
2654cd87af
@ -91,6 +91,8 @@ class MessageMixin(stateobject.StateObject):
|
||||
|
||||
Returns the number of replacements made.
|
||||
"""
|
||||
count = 0
|
||||
if self.content:
|
||||
with decoded(self):
|
||||
self.content, count = utils.safe_subn(
|
||||
pattern, repl, self.content, *args, **kwargs
|
||||
|
@ -463,6 +463,11 @@ class TestFlow(object):
|
||||
f.response.content = "\xc2foo"
|
||||
f.replace("foo", u"bar")
|
||||
|
||||
def test_replace_no_content(self):
|
||||
f = tutils.tflow()
|
||||
f.request.content = CONTENT_MISSING
|
||||
assert f.replace("foo", "bar") == 0
|
||||
|
||||
def test_replace(self):
|
||||
f = tutils.tflow(resp=True)
|
||||
f.request.headers["foo"] = "foo"
|
||||
|
Loading…
Reference in New Issue
Block a user