8
8
import zlib
9
9
from abc import ABC , abstractmethod
10
10
from enum import Enum
11
- from functools import partial , wraps
11
+ from functools import partial
12
12
from http import HTTPStatus
13
13
from typing import Any , Callable , Dict , List , Optional , Set , Union
14
14
@@ -669,7 +669,7 @@ def include_router(self, router: "Router", prefix: Optional[str] = None) -> None
669
669
rule = prefix if rule == "/" else f"{ prefix } { rule } "
670
670
route = (rule , * route [1 :])
671
671
672
- self .route (* route )(func () )
672
+ self .route (* route )(func )
673
673
674
674
675
675
class Router (BaseRouter ):
@@ -696,18 +696,11 @@ def route(
696
696
compress : bool = False ,
697
697
cache_control : Optional [str ] = None ,
698
698
):
699
- def actual_decorator (func : Callable ):
700
- @wraps (func )
701
- def wrapper ():
702
- def inner_wrapper (** kwargs ):
703
- return func (** kwargs )
704
-
705
- return inner_wrapper
706
-
699
+ def register_route (func : Callable ):
707
700
if isinstance (method , (list , tuple )):
708
701
for item in method :
709
- self .routes [(rule , item , cors , compress , cache_control )] = wrapper
702
+ self .routes [(rule , item , cors , compress , cache_control )] = func
710
703
else :
711
- self .routes [(rule , method , cors , compress , cache_control )] = wrapper
704
+ self .routes [(rule , method , cors , compress , cache_control )] = func
712
705
713
- return actual_decorator
706
+ return register_route
0 commit comments