Skip to content

Commit 58a2640

Browse files
committed
encode the url for testing
1 parent 1ab06d0 commit 58a2640

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/test_proxies.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from http.client import HTTPConnection
3+
from urllib.parse import quote
34
import pytest
45

56
PORT = os.getenv('TEST_PORT', 8888)
@@ -17,10 +18,12 @@ def request_get(port, path, token, host='localhost'):
1718

1819

1920
def test_server_proxy_url_encoding():
20-
r = request_get(PORT, '/python-http/Hellö Wörld 🎉你好世界@±¥', TOKEN)
21+
special_path = 'Hellö Wörld 🎉你好世界@±¥'
22+
test_url = quote('/python-http/' + special_path)
23+
r = request_get(PORT, test_url, TOKEN)
2124
assert r.code == 200
2225
s = r.read().decode('utf-8')
23-
assert s.startswith('GET /Hellö Wörld 🎉你好世界@±¥?token=')
26+
assert s.startswith('GET /{}?token='.format(special_path))
2427

2528

2629
def test_server_proxy_non_absolute():

0 commit comments

Comments
 (0)