aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/request.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2016-08-31 13:49:03 +0200
committerGitHub <noreply@github.com>2016-08-31 13:49:03 +0200
commitb4b2e5fd3431ea3c8b8f00b8f92e8c7fc6f309ae (patch)
tree6ce6930f0f2db77c7d90bb940b359f4ea5eded73 /netlib/http/request.py
parent6afbfc85266e783b1bad432ae1f6715bfb16a39f (diff)
parenta8deed1f4ef5992b1c9c74ac69491bdb5f0e8490 (diff)
downloadmitmproxy-b4b2e5fd3431ea3c8b8f00b8f92e8c7fc6f309ae.tar.gz
mitmproxy-b4b2e5fd3431ea3c8b8f00b8f92e8c7fc6f309ae.tar.bz2
mitmproxy-b4b2e5fd3431ea3c8b8f00b8f92e8c7fc6f309ae.zip
Merge pull request #1511 from arjun23496/count_in_replace
Fixes #1495 - Added count argument for replacing contents in body
Diffstat (limited to 'netlib/http/request.py')
-rw-r--r--netlib/http/request.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/netlib/http/request.py b/netlib/http/request.py
index 666a5869..e0aaa8a9 100644
--- a/netlib/http/request.py
+++ b/netlib/http/request.py
@@ -80,7 +80,7 @@ class Request(message.Message):
self.method, hostport, path
)
- def replace(self, pattern, repl, flags=0):
+ def replace(self, pattern, repl, flags=0, count=0):
"""
Replaces a regular expression pattern with repl in the headers, the
request path and the body of the request. Encoded content will be
@@ -94,9 +94,9 @@ class Request(message.Message):
if isinstance(repl, six.text_type):
repl = strutils.escaped_str_to_bytes(repl)
- c = super(Request, self).replace(pattern, repl, flags)
+ c = super(Request, self).replace(pattern, repl, flags, count)
self.path, pc = re.subn(
- pattern, repl, self.data.path, flags=flags
+ pattern, repl, self.data.path, flags=flags, count=count
)
c += pc
return c