aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/net/http/url.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mitmproxy/net/http/url.py b/mitmproxy/net/http/url.py
index d3b93994..f938cb12 100644
--- a/mitmproxy/net/http/url.py
+++ b/mitmproxy/net/http/url.py
@@ -76,9 +76,9 @@ def encode(s: Sequence[Tuple[str, str]], similar_to: str=None) -> str:
encoded = urllib.parse.urlencode(s, False, errors="surrogateescape")
- if remove_trailing_equal:
+ if encoded and remove_trailing_equal:
encoded = encoded.replace("=&", "&")
- if encoded and encoded[-1] == '=':
+ if encoded[-1] == '=':
encoded = encoded[:-1]
return encoded