From af15fe668d3243a482844dd836e7b316b4a0da5d Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Sun, 3 Nov 2019 10:09:34 +0400 Subject: [PATCH] Use better Tornado handler to test fragment encoding --- dummyserver/handlers.py | 4 ++++ test/with_dummyserver/test_connectionpool.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dummyserver/handlers.py b/dummyserver/handlers.py index 8089432af0..b751d83fcc 100644 --- a/dummyserver/handlers.py +++ b/dummyserver/handlers.py @@ -229,6 +229,10 @@ def echo(self, request): return Response(request.body) + def echo_uri(self, request): + "Echo back the requested URI" + return Response(request.uri) + def encodingrequest(self, request): "Check for UA accepting gzip/deflate encoding" data = b"hello, world!" diff --git a/test/with_dummyserver/test_connectionpool.py b/test/with_dummyserver/test_connectionpool.py index afc30cb939..5ca8e402f6 100644 --- a/test/with_dummyserver/test_connectionpool.py +++ b/test/with_dummyserver/test_connectionpool.py @@ -717,8 +717,8 @@ def test_percent_encode_invalid_target_chars(self): def test_percent_encode_fragment(self): with HTTPConnectionPool(self.host, self.port) as pool: - r = pool.request("GET", "/echo_params?q=1#fragment") - assert r.data == b"[('q', '1#fragment')]" + r = pool.request("GET", "/echo_uri?q=1#fragment") + assert r.data == b"/echo_uri?q=1#fragment" def test_source_address(self): for addr, is_ipv6 in VALID_SOURCE_ADDRESSES: