diff --git a/docs/release-notes.md b/docs/release-notes.md index cbedd51a..3848517a 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,3 +1,9 @@ +## 0.8.2 + +## StaticFiles + +* StaticFiles no longer reads the file for responses to `HEAD` requests. + ## 0.8.1 ## Templating diff --git a/scripts/publish b/scripts/publish index ced33562..eb9235e0 100755 --- a/scripts/publish +++ b/scripts/publish @@ -17,6 +17,7 @@ find starlette -type d -name __pycache__ -delete ${PREFIX}python setup.py sdist ${PREFIX}twine upload dist/* +${PREFIX}mkdocs gh-deploy echo "You probably want to also tag the version now:" echo "git tag -a ${VERSION} -m 'version ${VERSION}'" diff --git a/starlette/__init__.py b/starlette/__init__.py index 8088f751..deded324 100644 --- a/starlette/__init__.py +++ b/starlette/__init__.py @@ -1 +1 @@ -__version__ = "0.8.1" +__version__ = "0.8.2" diff --git a/starlette/applications.py b/starlette/applications.py index 560a60eb..33b67ce4 100644 --- a/starlette/applications.py +++ b/starlette/applications.py @@ -92,12 +92,15 @@ class Starlette: path: str, route: typing.Callable, methods: typing.List[str] = None, + name: str = None, include_in_schema: bool = True, ) -> None: - self.router.add_route(path, route, methods=methods) + self.router.add_route(path, route, methods=methods, name=name) - def add_websocket_route(self, path: str, route: typing.Callable) -> None: - self.router.add_websocket_route(path, route) + def add_websocket_route( + self, path: str, route: typing.Callable, name: str = None + ) -> None: + self.router.add_websocket_route(path, route, name=name) def exception_handler( self, exc_class_or_status_code: typing.Union[int, typing.Type[Exception]] @@ -112,19 +115,24 @@ class Starlette: self, path: str, methods: typing.List[str] = None, + name: str = None, include_in_schema: bool = True, ) -> typing.Callable: def decorator(func: typing.Callable) -> typing.Callable: self.router.add_route( - path, func, methods=methods, include_in_schema=include_in_schema + path, + func, + methods=methods, + name=name, + include_in_schema=include_in_schema, ) return func return decorator - def websocket_route(self, path: str) -> typing.Callable: + def websocket_route(self, path: str, name: str = None) -> typing.Callable: def decorator(func: typing.Callable) -> typing.Callable: - self.router.add_websocket_route(path, func) + self.router.add_websocket_route(path, func, name=name) return func return decorator diff --git a/starlette/routing.py b/starlette/routing.py index 66037166..c6b6e983 100644 --- a/starlette/routing.py +++ b/starlette/routing.py @@ -295,37 +295,46 @@ class Router: path: str, endpoint: typing.Callable, methods: typing.List[str] = None, + name: str = None, include_in_schema: bool = True, ) -> None: route = Route( path, endpoint=endpoint, methods=methods, + name=name, include_in_schema=include_in_schema, ) self.routes.append(route) - def add_websocket_route(self, path: str, endpoint: typing.Callable) -> None: - route = WebSocketRoute(path, endpoint=endpoint) + def add_websocket_route( + self, path: str, endpoint: typing.Callable, name: str = None + ) -> None: + route = WebSocketRoute(path, endpoint=endpoint, name=name) self.routes.append(route) def route( self, path: str, methods: typing.List[str] = None, + name: str = None, include_in_schema: bool = True, ) -> typing.Callable: def decorator(func: typing.Callable) -> typing.Callable: self.add_route( - path, func, methods=methods, include_in_schema=include_in_schema + path, + func, + methods=methods, + name=name, + include_in_schema=include_in_schema, ) return func return decorator - def websocket_route(self, path: str) -> typing.Callable: + def websocket_route(self, path: str, name: str = None) -> typing.Callable: def decorator(func: typing.Callable) -> typing.Callable: - self.add_websocket_route(path, func) + self.add_websocket_route(path, func, name=name) return func return decorator