Strict trailing slash (#64)

* Update pre-commit versions

* Fix for strict_trailing_slash
This commit is contained in:
Michael Lazar 2022-07-06 17:29:42 -04:00 committed by GitHub
parent 93e0a3ddc7
commit 37add0c605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -3,10 +3,10 @@ default_language_version:
default_stages: [commit, push] default_stages: [commit, push]
repos: repos:
- repo: https://github.com/ambv/black - repo: https://github.com/ambv/black
rev: stable rev: 22.6.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/pre-commit/mirrors-isort - repo: https://github.com/pre-commit/mirrors-isort
rev: v5.1.4 rev: v5.10.1
hooks: hooks:
- id: isort - id: isort

View File

@ -2,6 +2,11 @@
### Unreleased ### Unreleased
#### Changes
- Fix ``strict_trailing_slash`` argument being applied as
`strict_port` when specified on a route decorator.
### v0.9.0 (2021-05-12) ### v0.9.0 (2021-05-12)
#### Fixes #### Fixes

View File

@ -296,6 +296,7 @@ class JetforceApplication:
scheme: str = "gemini", scheme: str = "gemini",
hostname: typing.Optional[str] = None, hostname: typing.Optional[str] = None,
strict_hostname: bool = True, strict_hostname: bool = True,
strict_port: bool = True,
strict_trailing_slash: bool = False, strict_trailing_slash: bool = False,
) -> typing.Callable[[RouteHandler], RouteHandler]: ) -> typing.Callable[[RouteHandler], RouteHandler]:
""" """
@ -308,7 +309,12 @@ class JetforceApplication:
return Response(Status.SUCCESS, 'text/plain', 'Hello world!') return Response(Status.SUCCESS, 'text/plain', 'Hello world!')
""" """
route_pattern = RoutePattern( route_pattern = RoutePattern(
path, scheme, hostname, strict_hostname, strict_trailing_slash path=path,
scheme=scheme,
hostname=hostname,
strict_hostname=strict_hostname,
strict_port=strict_port,
strict_trailing_slash=strict_trailing_slash,
) )
def wrap(func: RouteHandler) -> RouteHandler: def wrap(func: RouteHandler) -> RouteHandler: