8
8
"""
9
9
10
10
try :
11
- from typing import Callable , List , Set , Union , Tuple , TYPE_CHECKING
11
+ from typing import Callable , List , Set , Union , Tuple , Dict , TYPE_CHECKING
12
12
13
13
if TYPE_CHECKING :
14
14
from .response import Response
@@ -56,7 +56,7 @@ def _validate_path(path: str, append_slash: bool) -> None:
56
56
if path .endswith ("/" ) and append_slash :
57
57
raise ValueError ("Cannot use append_slash=True when path ends with /" )
58
58
59
- def match (self , other : "Route" ) -> Tuple [bool , List [ str ]]:
59
+ def match (self , other : "Route" ) -> Tuple [bool , Dict [ str , str ]]:
60
60
"""
61
61
Checks if the route matches the other route.
62
62
@@ -72,31 +72,31 @@ def match(self, other: "Route") -> Tuple[bool, List[str]]:
72
72
73
73
other1a = Route("/example", GET)
74
74
other1b = Route("/example/", GET)
75
- route.matches(other1a) # True, []
76
- route.matches(other1b) # True, []
75
+ route.matches(other1a) # True, {}
76
+ route.matches(other1b) # True, {}
77
77
78
78
other2 = Route("/other-example", GET)
79
- route.matches(other2) # False, []
79
+ route.matches(other2) # False, {}
80
80
81
81
...
82
82
83
83
route = Route("/example/<parameter>", GET)
84
84
85
85
other1 = Route("/example/123", GET)
86
- route.matches(other1) # True, [" 123"]
86
+ route.matches(other1) # True, {"parameter": " 123"}
87
87
88
88
other2 = Route("/other-example", GET)
89
- route.matches(other2) # False, []
89
+ route.matches(other2) # False, {}
90
90
91
91
...
92
92
93
93
route1 = Route("/example/.../something", GET)
94
94
other1 = Route("/example/123/something", GET)
95
- route1.matches(other1) # True, []
95
+ route1.matches(other1) # True, {}
96
96
97
97
route2 = Route("/example/..../something", GET)
98
98
other2 = Route("/example/123/456/something", GET)
99
- route2.matches(other2) # True, []
99
+ route2.matches(other2) # True, {}
100
100
"""
101
101
102
102
if not other .methods .issubset (self .methods ):
0 commit comments