From 75ec05c85e597e66128c68c124f8a0376a5db7f2 Mon Sep 17 00:00:00 2001 From: Brad Dixon Date: Thu, 4 Jun 2020 20:26:31 -0400 Subject: HTTP2 response reason is None, render as '' in property. Fixes an error triggered when displaying an HTTP2 response loaded from a file. --- test/mitmproxy/net/http/test_response.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/net/http/test_response.py b/test/mitmproxy/net/http/test_response.py index 27c16be6..08d72840 100644 --- a/test/mitmproxy/net/http/test_response.py +++ b/test/mitmproxy/net/http/test_response.py @@ -77,6 +77,12 @@ class TestResponseCore: resp.data.reason = b'cr\xe9e' assert resp.reason == "crée" + # HTTP2 responses do not contain a reason phrase and self.data.reason will be None. + # This should render to an empty reason phrase so that functions + # expecting a string work properly. + resp.data.reason = None + assert resp.reason == "" + class TestResponseUtils: """ -- cgit v1.2.3