From 10cbbfad4b2796ed5afec1ea5f777149a2030f6a Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Thu, 29 May 2025 16:00:00 +0900 Subject: Ensure base URL's trailing slash for path matching --- tst/test_listen.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tst/test_listen.py') diff --git a/tst/test_listen.py b/tst/test_listen.py index 4d49ae2..ea58cc9 100644 --- a/tst/test_listen.py +++ b/tst/test_listen.py @@ -241,3 +241,11 @@ async def test_unallowed_method(base_url, request): await writer.drain() response = await reader.readuntil(b'\r\n') assert response == b'HTTP/1.1 405 Method Not Allowed\r\n' + + +@given(urls()) +def test_with_trailing_slash(base_url): + if base_url.endswith('/'): + assert with_trailing_slash(base_url) == base_url + else: + assert with_trailing_slash(base_url) == f'{base_url}/' -- cgit 1.4.1