Skip to content

Commit 116621b

Browse files
committed
Update tests based on review
1 parent a28026c commit 116621b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/apify_client/clients/base/base_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def _url(self, path: str | None = None, *, public: bool = False) -> str:
2222
url = f'{self.url}/{path}' if path is not None else self.url
2323

2424
if public:
25-
return url.replace(self.root_client.base_url, self.root_client.public_base_url)
25+
if not url.startswith(self.root_client.base_url):
26+
raise ValueError('API based URL has to start with `self.root_client.base_url`')
27+
return url.replace(self.root_client.base_url, self.root_client.public_base_url, 1)
2628
return url
2729

2830
def _params(self, **kwargs: Any) -> dict:

tests/integration/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
('https://api.apify.com', 'https://custom-public-url.com/with/custom/path'),
1717
('https://api.apify.com', 'https://custom-public-url.com/with/custom/path/'),
1818
('http://10.0.88.214:8010', 'https://api.apify.com'),
19+
('http://10.0.88.214:8010', None),
1920
],
2021
)
2122

0 commit comments

Comments
 (0)