Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sdk/core/azure-core/azure/core/pipeline/transport/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ def _urljoin(base_url: str, stub_url: str) -> str:

# Note that _replace is a public API named that way to avoid conflicts in namedtuple
# https://docs.python.org/3/library/collections.html?highlight=namedtuple#collections.namedtuple
parsed_base_url = parsed_base_url._replace(
path=parsed_base_url.path.rstrip("/") + "/" + stub_url_path,
)
if stub_url_path:
parsed_base_url = parsed_base_url._replace(
path=parsed_base_url.path.rstrip("/") + "/" + stub_url_path,
)
if stub_url_query:
query_params = [stub_url_query]
if parsed_base_url.query:
Expand Down
3 changes: 2 additions & 1 deletion sdk/core/azure-core/tests/test_basic_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def test_http_request_serialization(http_request):

@pytest.mark.parametrize("http_request", HTTP_REQUESTS)
def test_url_join(http_request):
assert _urljoin("devstoreaccount1", "") == "devstoreaccount1/"
assert _urljoin("devstoreaccount1", "?testdir") == "devstoreaccount1?testdir"
assert _urljoin("devstoreaccount1", "") == "devstoreaccount1"
assert _urljoin("devstoreaccount1", "testdir/") == "devstoreaccount1/testdir/"
assert _urljoin("devstoreaccount1/", "") == "devstoreaccount1/"
assert _urljoin("devstoreaccount1/", "testdir/") == "devstoreaccount1/testdir/"
Expand Down
Loading