Skip to content

Commit

Permalink
FIX: Allow cors.auth to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
sanand0 committed Oct 23, 2023
1 parent e183d52 commit c55e789
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gramex/handlers/basehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,13 @@ def setup_cors(cls, cors: Union[None, bool, dict], auth):
if not isinstance(cors, dict):
app_log.error(f'url:{cls.name}.cors is not a dict/True')
return
cls._cors = cors
# Set default CORS values as a set
for key in ('origins', 'methods', 'headers'):
cors[key] = cls.get_list(cors.get(key, '*'), f'cors.{key}', '"*"', caps=False)
cors.setdefault('auth', False)
cls._on_init_methods.append(cls.check_cors)
cls.options = cls._cors_options
cls._cors = cors

def check_cors(self):
'''
Expand Down

0 comments on commit c55e789

Please sign in to comment.