Skip to content

Fix allowed methods #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_app() -> FastAPI:
CORSMiddleware,
allow_origins=api_settings.http_allowed_origins,
allow_credentials=True,
allow_methods=[method.name for method in api_settings.http_allowed_methods],
allow_methods=api_settings.http_allowed_methods,
allow_headers=api_settings.http_allowed_headers,
)
return server
Expand Down
4 changes: 2 additions & 2 deletions app/settings/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class Config:
@classmethod
def parse_env_var(cls, field_name: str, raw_val: str) -> Any:
"""Parse environment variables."""
if field_name in [
if field_name.lower() in [
"http_allowed_methods",
"http_allowed_headers",
"http_allowed_origins",
]:
raw_val = [(x.strip()) for x in raw_val.split(",")]
if field_name == "http_allowed_methods":
if field_name.lower() == "http_allowed_methods":
return [HttpMethod(x).value for x in raw_val]
return raw_val
# pylint: disable=no-member
Expand Down