fix(api-client): fix base_url joining for client v2 (#1998)

This commit is contained in:
Jonas L 2022-07-26 17:57:14 +02:00 committed by GitHub
parent d9725003c5
commit 6f0ab7d8f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 5 deletions

View file

@ -1,5 +1,4 @@
from typing import Optional
from urllib.parse import urljoin
from loguru import logger
from requests import Response
@ -51,7 +50,9 @@ class Session(BaseSession):
def create_url(self, url):
"""Create the URL based off this partial path."""
return urljoin(self.base_url, url)
if self.base_url is None:
return url
return f"{self.base_url.rstrip('/')}/{url.lstrip('/')}"
# pylint: disable=too-few-public-methods