diff --git a/setup.py b/setup.py index 602145b..c49d3ed 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="swagger-coverage", - version="3.2.0", + version="3.3.0", author="Jamal Zeinalov", author_email="jamal.zeynalov@gmail.com", description='Python adapter for "swagger-coverage" tool', diff --git a/swagger_coverage_py/listener.py b/swagger_coverage_py/listener.py index 6edaa9b..dd66cd8 100644 --- a/swagger_coverage_py/listener.py +++ b/swagger_coverage_py/listener.py @@ -7,7 +7,7 @@ class CoverageListener: def __init__( - self, method: str, base_url: str, raw_path: str, uri_params: dict, **kwargs + self, method: str, base_url: str, raw_path: str, uri_params: dict, base_path: str = "", **kwargs ): """Records an HTTP request as a file in swagger format @@ -19,7 +19,7 @@ def __init__( :param kwargs: Optional arguments that are applicable for appropriate request of "requests" library. (e.g. "auth", "headers", "cookies", etc.) """ - self.__uri = URI(base_url, raw_path, **uri_params) + self.__uri = URI(base_url, base_path, raw_path, **uri_params) self.response = requests.request(method, self.__uri.full, **kwargs) if not IS_DISABLED: diff --git a/swagger_coverage_py/uri.py b/swagger_coverage_py/uri.py index e150a6e..b8a72b9 100644 --- a/swagger_coverage_py/uri.py +++ b/swagger_coverage_py/uri.py @@ -1,7 +1,8 @@ class URI: - def __init__(self, host: str, unformatted_path: str, **uri_params): + def __init__(self, host: str, base_path, unformatted_path: str, **uri_params): self.host = host - self.formatted = unformatted_path.format(**uri_params) + self.formatted = base_path + unformatted_path.format(**uri_params) self.full = f"{self.host}{self.formatted}" self.raw = unformatted_path + self.base_path = base_path self.uri_params: dict = uri_params