mirror of https://github.com/encode/starlette.git
Fix grammar with assertion message (#266)
It should probably also not be an `assert` in the first place (which might be optimized out)?!
This commit is contained in:
parent
9d0b4c01bd
commit
d96f1f32b3
|
@ -149,7 +149,7 @@ class Route(BaseRoute):
|
||||||
name: str = None,
|
name: str = None,
|
||||||
include_in_schema: bool = True
|
include_in_schema: bool = True
|
||||||
) -> None:
|
) -> None:
|
||||||
assert path.startswith("/"), "Routed paths must always start '/'"
|
assert path.startswith("/"), "Routed paths must start with '/'"
|
||||||
self.path = path
|
self.path = path
|
||||||
self.endpoint = endpoint
|
self.endpoint = endpoint
|
||||||
self.name = get_name(endpoint) if name is None else name
|
self.name = get_name(endpoint) if name is None else name
|
||||||
|
@ -218,7 +218,7 @@ class WebSocketRoute(BaseRoute):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, path: str, endpoint: typing.Callable, *, name: str = None
|
self, path: str, endpoint: typing.Callable, *, name: str = None
|
||||||
) -> None:
|
) -> None:
|
||||||
assert path.startswith("/"), "Routed paths must always start '/'"
|
assert path.startswith("/"), "Routed paths must start with '/'"
|
||||||
self.path = path
|
self.path = path
|
||||||
self.endpoint = endpoint
|
self.endpoint = endpoint
|
||||||
self.name = get_name(endpoint) if name is None else name
|
self.name = get_name(endpoint) if name is None else name
|
||||||
|
@ -275,7 +275,7 @@ class WebSocketRoute(BaseRoute):
|
||||||
|
|
||||||
class Mount(BaseRoute):
|
class Mount(BaseRoute):
|
||||||
def __init__(self, path: str, app: ASGIApp, name: str = None) -> None:
|
def __init__(self, path: str, app: ASGIApp, name: str = None) -> None:
|
||||||
assert path == "" or path.startswith("/"), "Routed paths must always start '/'"
|
assert path == "" or path.startswith("/"), "Routed paths must start with '/'"
|
||||||
self.path = path.rstrip("/")
|
self.path = path.rstrip("/")
|
||||||
self.app = app
|
self.app = app
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
Loading…
Reference in New Issue