From b5cf563b8f4d1107a993ea01df2946183a61d0a6 Mon Sep 17 00:00:00 2001 From: abhishekbhakat Date: Sun, 4 May 2025 08:59:45 +0000 Subject: [PATCH] feat: set default empty dict for API execution parameters in AirflowClient --- src/airflow_mcp_server/client/airflow_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/airflow_mcp_server/client/airflow_client.py b/src/airflow_mcp_server/client/airflow_client.py index ba081c3..e3c6fd3 100644 --- a/src/airflow_mcp_server/client/airflow_client.py +++ b/src/airflow_mcp_server/client/airflow_client.py @@ -128,13 +128,17 @@ class AirflowClient: """Execute an API operation.""" if not self._client: raise RuntimeError("Client not in async context") + # Default all params to empty dict if None + path_params = path_params or {} + query_params = query_params or {} + body = body or {} path, method, _ = self._get_operation(operation_id) self._validate_path_params(path, path_params) if path_params: path = path.format(**path_params) url = f"{self.base_url.rstrip('/')}{path}" request_headers = self.headers.copy() - if body is not None: + if body: request_headers["Content-Type"] = "application/json" try: response = await self._client.request(