Skip to content

Commit

Permalink
Tidy cors
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnisbet committed Feb 20, 2024
1 parent 0d111ac commit cc7f997
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions opentopodata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ def apply_cors(response):
of the access_control_allow_origin config option.
"""
try:
if _load_config()["access_control_allow_origin"]:
response.headers["access-control-allow-origin"] = _load_config()[
"access_control_allow_origin"
]
cors_value = _load_config()["access_control_allow_origin"]
if cors_value:
response.headers["access-control-allow-origin"] = cors_value
except config.ConfigError:
# If the config isn't loading, allow the request to complete without
# CORS so user can see error message.
Expand Down

0 comments on commit cc7f997

Please sign in to comment.