Skip to content

Commit 6d94598

Browse files
arfioMatthewKhouzam
authored andcommitted
add slash if not existant in base url
This adds a slash if one is not added in the configured value. It removes one possibility of user error. Signed-off-by: Arnaud Fiorini <[email protected]>
1 parent 04b3632 commit 6d94598

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

test_tsp.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ def test_fetch_traces(self):
121121
self._delete_experiments()
122122
self._delete_traces()
123123

124+
def test_fetch_with_other_client(self):
125+
"""Expect client without end slash to respond with no traces"""
126+
tsp_client = TspClient('http://localhost:8080/tsp/api')
127+
response = tsp_client.fetch_traces()
128+
assert response.status_code == 200
129+
assert not response.model.traces
130+
124131
def test_fetch_traces_none(self):
125132
"""Expect no traces without opening any."""
126133
response = self.tsp_client.fetch_traces()

tsp/tsp_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, base_url):
6868
'''
6969
Constructor
7070
'''
71-
self.base_url = base_url
71+
self.base_url = base_url if base_url.endswith('/') else base_url + '/'
7272

7373
def fetch_traces(self):
7474
'''

0 commit comments

Comments
 (0)