Skip to content

Commit

Permalink
Fix WebSocket dependent path
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Aug 31, 2022
1 parent 9d54110 commit f1afa0d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
4 changes: 2 additions & 2 deletions fastapi/routing.py
Expand Up @@ -297,14 +297,14 @@ def __init__(
self.path = path
self.endpoint = endpoint
self.name = get_name(endpoint) if name is None else name
self.dependant = get_dependant(path=path, call=self.endpoint)
self.path_regex, self.path_format, self.param_convertors = compile_path(path)
self.dependant = get_dependant(path=self.path_format, call=self.endpoint)
self.app = websocket_session(
get_websocket_app(
dependant=self.dependant,
dependency_overrides_provider=dependency_overrides_provider,
)
)
self.path_regex, self.path_format, self.param_convertors = compile_path(path)

def matches(self, scope: Scope) -> Tuple[Match, Scope]:
match, child_scope = super().matches(scope)
Expand Down
2 changes: 1 addition & 1 deletion fastapi/utils.py
Expand Up @@ -42,7 +42,7 @@ def get_model_definitions(


def get_path_param_names(path: str) -> Set[str]:
return {name.split(":")[0] for name in re.findall("{(.*?)}", path)}
return set(re.findall("{(.*?)}", path))


def create_response_field(
Expand Down
14 changes: 0 additions & 14 deletions tests/test_utils.py

This file was deleted.

0 comments on commit f1afa0d

Please sign in to comment.