@@ -141,19 +141,14 @@ def test_path_query_fragment(url, raw_path, path, query, fragment):
141141
142142
143143def test_url_query_encoding ():
144- """
145- URL query parameters should use '%20' for encoding spaces,
146- and should treat '/' as a safe character. This behaviour differs
147- across clients, but we're matching browser behaviour here.
148-
149- See https://github.com/encode/httpx/issues/2536
150- and https://github.com/encode/httpx/discussions/2460
151- """
152144 url = httpx .URL ("https://www.example.com/?a=b c&d=e/f" )
153145 assert url .raw_path == b"/?a=b%20c&d=e/f"
154146
147+ url = httpx .URL ("https://www.example.com/?a=b+c&d=e/f" )
148+ assert url .raw_path == b"/?a=b+c&d=e/f"
149+
155150 url = httpx .URL ("https://www.example.com/" , params = {"a" : "b c" , "d" : "e/f" })
156- assert url .raw_path == b"/?a=b%20c &d=e%2Ff "
151+ assert url .raw_path == b"/?a=b+c &d=e/f "
157152
158153
159154def test_url_params ():
@@ -289,9 +284,10 @@ def test_url_leading_dot_prefix_on_relative_url():
289284
290285
291286def test_param_with_space ():
292- # Params passed as form key-value pairs should be escaped.
287+ # Params passed as form key-value pairs should be form escaped,
288+ # Including the special case of "+" for space seperators.
293289 url = httpx .URL ("http://webservice" , params = {"u" : "with spaces" })
294- assert str (url ) == "http://webservice?u=with%20spaces "
290+ assert str (url ) == "http://webservice?u=with+spaces "
295291
296292
297293def test_param_requires_encoding ():
@@ -313,7 +309,7 @@ def test_param_with_existing_escape_requires_encoding():
313309 # even if they include a valid escape sequence.
314310 # We want to match browser form behaviour here.
315311 url = httpx .URL ("http://webservice" , params = {"u" : "http://example.com?q=foo%2Fa" })
316- assert str (url ) == "http://webservice?u=http%3A%2F%2Fexample .com%3Fq %3Dfoo%252Fa"
312+ assert str (url ) == "http://webservice?u=http://example .com?q %3Dfoo%252Fa"
317313
318314
319315# Tests for query parameter percent encoding.
0 commit comments