vincbeck commented on code in PR #40999:
URL: https://github.com/apache/airflow/pull/40999#discussion_r1689970903
##########
airflow/api_internal/endpoints/rpc_api_endpoint.py:
##########
@@ -163,6 +163,12 @@ def log_and_build_error_response(message, status):
def internal_airflow_api(body: dict[str, Any]) -> APIResponse:
"""Handle Internal API /internal_api/v1/rpcapi endpoint."""
+ content_type = request.headers.get("Content-Type", "")
+ if content_type != "application/json":
+ raise PermissionDenied("Expected Content-Type: application/json")
+ accept = request.headers.get("Accept", "")
+ if accept != "application/json":
+ raise PermissionDenied("Expected Accept: application/json")
Review Comment:
nit: there is no need to set default values?
```suggestion
content_type = request.headers.get("Content-Type")
if content_type != "application/json":
raise PermissionDenied("Expected Content-Type: application/json")
accept = request.headers.get("Accept")
if accept != "application/json":
raise PermissionDenied("Expected Accept: application/json")
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]