Skip to content

Commit

Permalink
Fix regression decoding query string params in join urls
Browse files Browse the repository at this point in the history
#1039 introduced a regression in decoding query
string params
  • Loading branch information
bdraco committed Aug 31, 2024
1 parent 9407fcd commit 578d94f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,3 +1853,32 @@ def test_requoting():
u = URL("http://127.0.0.1/?next=http%3A//example.com/")
assert u.raw_query_string == "next=http://example.com/"
assert str(u) == "http://127.0.0.1/?next=http://example.com/"


@pytest.mark.xfail
def test_join_query_string():
"""Test that query strings are correctly joined."""
original = URL("http://127.0.0.1:62869")
path_url = URL(
"/api?start=2022-03-27T14:05:00%2B03:00&end=2022-03-27T16:05:00%2B03:00"
)
assert original.query_string == ""
assert (
path_url.query_string
== "start=2022-03-27T14:05:00%2B03:00&end=2022-03-27T16:05:00%2B03:00"
)
assert path_url.query.get("start") == "2022-03-27T14:05:00+03:00"
assert path_url.query.get("end") == "2022-03-27T16:05:00+03:00"
new = original.join(path_url)
assert new.query.get("start") == "2022-03-27T14:05:00+03:00"
assert new.query.get("end") == "2022-03-27T16:05:00+03:00"


def test_join_encoded_url():
"""Test that url encoded urls are correctly joined."""
original = URL("http://127.0.0.1:62869")
path_url = URL("/api/%34")
assert original.path == "/"
assert path_url.path == "/api/4"
new = original.join(path_url)
assert new.path == "/api/4"

0 comments on commit 578d94f

Please sign in to comment.