8
8
"""
9
9
10
10
try :
11
- from typing import Callable , List , Set , Union , Tuple , Dict , TYPE_CHECKING
11
+ from typing import Callable , List , Iterable , Union , Tuple , Dict , TYPE_CHECKING
12
12
13
13
if TYPE_CHECKING :
14
14
from .response import Response
@@ -26,7 +26,7 @@ class Route:
26
26
def __init__ (
27
27
self ,
28
28
path : str = "" ,
29
- methods : Union [str , Set [str ]] = GET ,
29
+ methods : Union [str , Iterable [str ]] = GET ,
30
30
handler : Callable = None ,
31
31
* ,
32
32
append_slash : bool = False ,
@@ -40,7 +40,7 @@ def __init__(
40
40
"..." , r"[^/]+"
41
41
) + ("/?" if append_slash else "" )
42
42
self .methods = (
43
- set (methods ) if isinstance (methods , (set , list )) else set ([methods ])
43
+ set (methods ) if isinstance (methods , (set , list , tuple )) else set ([methods ])
44
44
)
45
45
46
46
self .handler = handler
@@ -118,7 +118,7 @@ def __repr__(self) -> str:
118
118
119
119
def as_route (
120
120
path : str ,
121
- methods : Union [str , Set [str ]] = GET ,
121
+ methods : Union [str , Iterable [str ]] = GET ,
122
122
* ,
123
123
append_slash : bool = False ,
124
124
) -> "Callable[[Callable[..., Response]], Route]" :
0 commit comments