mik-laj commented on a change in pull request #9273:
URL: https://github.com/apache/airflow/pull/9273#discussion_r441916241
##########
File path: airflow/www/extensions/init_views.py
##########
@@ -92,15 +93,16 @@ def init_error_handlers(app: Flask):
app.register_error_handler(404, views.circles)
-def init_api_connexion(app: Flask):
+def init_api_connexion(app: Flask, csrf: CSRFProtect) -> None:
"""Initialize Stable API"""
spec_dir = path.join(ROOT_APP_DIR, 'api_connexion', 'openapi')
connexion_app = connexion.App(__name__, specification_dir=spec_dir,
skip_error_handlers=True)
connexion_app.app = app
- connexion_app.add_api(
+ api_bp = connexion_app.add_api(
specification='v1.yaml', base_path='/api/v1', validate_responses=True,
strict_validation=False
- )
+ ).blueprint
app.register_error_handler(ProblemException,
connexion_app.common_error_handler)
+ csrf.exempt(api_bp)
Review comment:
```suggestion
app.extensions['csrf'].exempt(api_bp)
```
Here is example:
https://github.com/apache/airflow/blob/master/airflow/www/extensions/init_views.py#L118
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]