|
10 | 10 | from enum import Enum |
11 | 11 | from functools import partial |
12 | 12 | from http import HTTPStatus |
13 | | -from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union |
| 13 | +from typing import Any, Callable, Dict, List, Match, Optional, Pattern, Set, Tuple, Type, Union |
14 | 14 |
|
15 | 15 | from aws_lambda_powertools.event_handler import content_types |
16 | 16 | from aws_lambda_powertools.event_handler.exceptions import NotFoundError, ServiceError |
@@ -167,7 +167,7 @@ class Route: |
167 | 167 | """Internally used Route Configuration""" |
168 | 168 |
|
169 | 169 | def __init__( |
170 | | - self, method: str, rule: Any, func: Callable, cors: bool, compress: bool, cache_control: Optional[str] |
| 170 | + self, method: str, rule: Pattern, func: Callable, cors: bool, compress: bool, cache_control: Optional[str] |
171 | 171 | ): |
172 | 172 | self.method = method.upper() |
173 | 173 | self.rule = rule |
@@ -555,7 +555,7 @@ def _resolve(self) -> ResponseBuilder: |
555 | 555 | for route in self._routes: |
556 | 556 | if method != route.method: |
557 | 557 | continue |
558 | | - match_results: Optional[re.Match] = route.rule.match(path) |
| 558 | + match_results: Optional[Match] = route.rule.match(path) |
559 | 559 | if match_results: |
560 | 560 | logger.debug("Found a registered route. Calling function") |
561 | 561 | return self._call_route(route, match_results.groupdict()) # pass fn args |
|
0 commit comments