Skip to content

Commit f02b08a

Browse files
committed
Added impacted files using util method
1 parent b025e42 commit f02b08a

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/databricks/sql/common/feature_flag.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Dict, Optional, List, Any, TYPE_CHECKING
77

88
from databricks.sql.common.http import HttpMethod
9+
from databricks.sql.common.url_utils import normalize_host_with_protocol
910

1011
if TYPE_CHECKING:
1112
from databricks.sql.client import Connection
@@ -67,7 +68,7 @@ def __init__(
6768

6869
endpoint_suffix = FEATURE_FLAGS_ENDPOINT_SUFFIX_FORMAT.format(__version__)
6970
self._feature_flag_endpoint = (
70-
f"https://{self._connection.session.host}{endpoint_suffix}"
71+
normalize_host_with_protocol(self._connection.session.host) + endpoint_suffix
7172
)
7273

7374
# Use the provided HTTP client

src/databricks/sql/telemetry/telemetry_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
TelemetryPushClient,
4848
CircuitBreakerTelemetryPushClient,
4949
)
50+
from databricks.sql.common.url_utils import normalize_host_with_protocol
5051

5152
if TYPE_CHECKING:
5253
from databricks.sql.client import Connection
@@ -278,7 +279,7 @@ def _send_telemetry(self, events):
278279
if self._auth_provider
279280
else self.TELEMETRY_UNAUTHENTICATED_PATH
280281
)
281-
url = f"https://{self._host_url}{path}"
282+
url = normalize_host_with_protocol(self._host_url) + path
282283

283284
headers = {"Accept": "application/json", "Content-Type": "application/json"}
284285

tests/unit/test_url_utils.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ class TestNormalizeHostWithProtocol:
2828
("myserver.com/", "https://myserver.com"),
2929
("https://myserver.com/", "https://myserver.com"),
3030
("http://localhost/", "http://localhost"),
31-
32-
# Real Databricks patterns
33-
("adb-123456.azuredatabricks.net", "https://adb-123456.azuredatabricks.net"),
34-
("https://adb-123456.azuredatabricks.net", "https://adb-123456.azuredatabricks.net"),
35-
("https://adb-123456.azuredatabricks.net/", "https://adb-123456.azuredatabricks.net"),
36-
("workspace.databricks.com/", "https://workspace.databricks.com"),
31+
3732
])
3833
def test_normalize_host_with_protocol(self, input_host, expected_output):
3934
"""Test host normalization with various input formats."""

0 commit comments

Comments
 (0)