diff options
author | kira0204 <rshtmudgal@gmail.com> | 2018-02-19 22:45:30 +0530 |
---|---|---|
committer | kira0204 <rshtmudgal@gmail.com> | 2018-02-19 22:45:30 +0530 |
commit | fb54bb377763b4e57c1a092610d83a2b9ac4e6e9 (patch) | |
tree | 988db7325bea75bfdb6e77e3dae096e5540c6fac | |
parent | a519afb9c92715880e5be91ffedc1d9f4e7ce904 (diff) | |
download | mitmproxy-fb54bb377763b4e57c1a092610d83a2b9ac4e6e9.tar.gz mitmproxy-fb54bb377763b4e57c1a092610d83a2b9ac4e6e9.tar.bz2 mitmproxy-fb54bb377763b4e57c1a092610d83a2b9ac4e6e9.zip |
Testing
-rw-r--r-- | mitmproxy/net/http/request.py | 5 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_request.py | 2 |
2 files changed, 2 insertions, 5 deletions
diff --git a/mitmproxy/net/http/request.py b/mitmproxy/net/http/request.py index 4ef6cceb..959fdd33 100644 --- a/mitmproxy/net/http/request.py +++ b/mitmproxy/net/http/request.py @@ -429,10 +429,7 @@ class Request(message.Message): def _get_urlencoded_form(self): is_valid_content_type = "application/x-www-form-urlencoded" in self.headers.get("content-type", "").lower() if is_valid_content_type: - try: - return tuple(mitmproxy.net.http.url.decode(self.get_text(strict=False))) - except ValueError: - pass + return tuple(mitmproxy.net.http.url.decode(self.get_text(strict=False))) return () def _set_urlencoded_form(self, form_data): diff --git a/test/mitmproxy/net/http/test_request.py b/test/mitmproxy/net/http/test_request.py index 3653d050..ef581a91 100644 --- a/test/mitmproxy/net/http/test_request.py +++ b/test/mitmproxy/net/http/test_request.py @@ -351,7 +351,7 @@ class TestRequestUtils: request.headers["Content-Type"] = "application/x-www-form-urlencoded" assert list(request.urlencoded_form.items()) == [("foobar", "baz")] request.raw_content = b"\xFF" - assert len(request.urlencoded_form) == 0 + assert len(request.urlencoded_form) == 1 def test_set_urlencoded_form(self): request = treq(content=b"\xec\xed") |