File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -71,9 +71,7 @@ def _build_url(self, path: str) -> str:
7171 stripped_path = path .strip ()
7272 if not stripped_path :
7373 raise HyperbrowserError ("path must not be empty" )
74- normalized_path = (
75- stripped_path if stripped_path .startswith ("/" ) else f"/{ stripped_path } "
76- )
74+ normalized_path = f"/{ stripped_path .lstrip ('/' )} "
7775 if normalized_path == "/api" or normalized_path .startswith ("/api/" ):
7876 return f"{ self .config .base_url } { normalized_path } "
7977 return f"{ self .config .base_url } /api{ normalized_path } "
Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ def test_client_build_url_normalizes_leading_slash():
2020 client ._build_url ("api/session" )
2121 == "https://api.hyperbrowser.ai/api/session"
2222 )
23+ assert (
24+ client ._build_url ("//api/session" )
25+ == "https://api.hyperbrowser.ai/api/session"
26+ )
27+ assert (
28+ client ._build_url ("///session" ) == "https://api.hyperbrowser.ai/api/session"
29+ )
2330 finally :
2431 client .close ()
2532
You can’t perform that action at this time.
0 commit comments