Skip to content

Commit 32468b5

Browse files
committed
Don't stop adding the trailing slash.
1 parent 249af18 commit 32468b5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

mocket/mocks/mockhttp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def __init__(self, uri, method, responses, match_querystring: bool = True):
153153

154154
super().__init__((uri.hostname, port), responses)
155155
self.schema = uri.scheme
156-
self.path = uri.path
156+
self.path = uri.path or "/"
157157
self.query = uri.query
158158
self.method = method.upper()
159159
self._sent_data = b""

tests/test_http.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,3 +443,8 @@ def test_invalid_config_key(self):
443443
Response(body='{"foo":"bar0"}', status=200),
444444
invalid_key=True,
445445
)
446+
447+
def test_add_trailing_slash(self):
448+
url = "http://testme.org"
449+
entry = Entry(url, "GET", [Response(body='{"foo":"bar0"}', status=200)])
450+
self.assertEqual(entry.path, "/")

0 commit comments

Comments
 (0)