From 37add0c6054834904dee8736d0a3f05ed1c165d1 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Wed, 6 Jul 2022 17:29:42 -0400 Subject: [PATCH] Strict trailing slash (#64) * Update pre-commit versions * Fix for strict_trailing_slash --- .pre-commit-config.yaml | 4 ++-- CHANGELOG.md | 5 +++++ jetforce/app/base.py | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be145a7..7334c8b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,10 +3,10 @@ default_language_version: default_stages: [commit, push] repos: - repo: https://github.com/ambv/black - rev: stable + rev: 22.6.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-isort - rev: v5.1.4 + rev: v5.10.1 hooks: - id: isort diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1000f..9dc77fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ### Unreleased +#### Changes + +- Fix ``strict_trailing_slash`` argument being applied as + `strict_port` when specified on a route decorator. + ### v0.9.0 (2021-05-12) #### Fixes diff --git a/jetforce/app/base.py b/jetforce/app/base.py index ac42cf0..fddc237 100644 --- a/jetforce/app/base.py +++ b/jetforce/app/base.py @@ -296,6 +296,7 @@ class JetforceApplication: scheme: str = "gemini", hostname: typing.Optional[str] = None, strict_hostname: bool = True, + strict_port: bool = True, strict_trailing_slash: bool = False, ) -> typing.Callable[[RouteHandler], RouteHandler]: """ @@ -308,7 +309,12 @@ class JetforceApplication: return Response(Status.SUCCESS, 'text/plain', 'Hello world!') """ 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: