Skip to content

Commit 85a78ad

Browse files
Merge pull request #25 from JamalZeynalov/23-coverage-recorder-didnt-support-swagger-basepath
Add "base_path" listener parameter to support basePath
2 parents 63fffaa + 01e3d37 commit 85a78ad

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="swagger-coverage",
8-
version="3.2.0",
8+
version="3.3.0",
99
author="Jamal Zeinalov",
1010
author_email="jamal.zeynalov@gmail.com",
1111
description='Python adapter for "swagger-coverage" tool',

swagger_coverage_py/listener.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class CoverageListener:
99
def __init__(
10-
self, method: str, base_url: str, raw_path: str, uri_params: dict, **kwargs
10+
self, method: str, base_url: str, raw_path: str, uri_params: dict, base_path: str = "", **kwargs
1111
):
1212
"""Records an HTTP request as a file in swagger format
1313
@@ -19,7 +19,7 @@ def __init__(
1919
:param kwargs: Optional arguments that are applicable
2020
for appropriate request of "requests" library. (e.g. "auth", "headers", "cookies", etc.)
2121
"""
22-
self.__uri = URI(base_url, raw_path, **uri_params)
22+
self.__uri = URI(base_url, base_path, raw_path, **uri_params)
2323
self.response = requests.request(method, self.__uri.full, **kwargs)
2424

2525
if not IS_DISABLED:

swagger_coverage_py/uri.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class URI:
2-
def __init__(self, host: str, unformatted_path: str, **uri_params):
2+
def __init__(self, host: str, base_path, unformatted_path: str, **uri_params):
33
self.host = host
4-
self.formatted = unformatted_path.format(**uri_params)
4+
self.formatted = base_path + unformatted_path.format(**uri_params)
55
self.full = f"{self.host}{self.formatted}"
66
self.raw = unformatted_path
77
self.uri_params: dict = uri_params

0 commit comments

Comments
 (0)