Skip to content

Commit dc16f7f

Browse files
dspatoulasDJ Spatoulas
andauthored
Only prefix a slash on the api_gateway_base_path if needed (#138)
* Only prefix a slash on the api_gateway_base_path if needed * Improve readability and compatibility with black python linter Co-authored-by: DJ Spatoulas <djs@knowbe4.com>
1 parent f83e42b commit dc16f7f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ venv.bak/
102102

103103
# mypy
104104
.mypy_cache/
105+
106+
# IDE Settings
107+
.idea/

mangum/adapter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ def __post_init__(self, enable_lifespan: bool) -> None:
8484
"Invalid argument supplied for `log_level`. "
8585
"Choices are: critical|error|warning|info|debug"
8686
)
87-
if self.api_gateway_base_path:
87+
should_prefix_base_path = (
88+
self.api_gateway_base_path
89+
and not self.api_gateway_base_path.startswith("/")
90+
)
91+
if should_prefix_base_path:
8892
self.api_gateway_base_path = f"/{self.api_gateway_base_path}"
8993
if self.text_mime_types:
9094
self.text_mime_types = self.text_mime_types + DEFAULT_TEXT_MIME_TYPES

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pytest-cov
55
black
66
starlette
77
quart; python_version == '3.7'
8-
dataclasses; python_version < '3.7'
98
moto
109
mypy
1110

0 commit comments

Comments
 (0)