Skip to content
Merged
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
1 change: 1 addition & 0 deletions airflow-ctl/src/airflowctl/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def _get_base_url(
cls, base_url: str, kind: Literal[ClientKind.AUTH, ClientKind.CLI] = ClientKind.CLI
) -> str:
"""Get the base URL of the client."""
base_url = base_url.rstrip("/")
if kind == ClientKind.AUTH:
return f"{base_url}/auth"
return f"{base_url}/api/v2"
Expand Down
4 changes: 4 additions & 0 deletions airflow-ctl/tests/airflow_ctl/api/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ def handle_request(request: httpx.Request) -> httpx.Response:
("http://localhost:8080", ClientKind.AUTH, "http://localhost:8080/auth/"),
("https://example.com", ClientKind.CLI, "https://example.com/api/v2/"),
("https://example.com", ClientKind.AUTH, "https://example.com/auth/"),
("http://localhost:8080/", ClientKind.CLI, "http://localhost:8080/api/v2/"),
("http://localhost:8080/", ClientKind.AUTH, "http://localhost:8080/auth/"),
("https://example.com/", ClientKind.CLI, "https://example.com/api/v2/"),
("https://example.com/", ClientKind.AUTH, "https://example.com/auth/"),
],
)
def test_refresh_base_url(self, base_url, client_kind, expected_base_url):
Expand Down