This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 288b09a5c44 Add Content-Type to Request Header in Task SDK calls, fix 
logic (#59676)
288b09a5c44 is described below

commit 288b09a5c446f7bcf63c14c6c72b66f76116621f
Author: Jens Scheffler <[email protected]>
AuthorDate: Sun Dec 21 10:59:17 2025 +0100

    Add Content-Type to Request Header in Task SDK calls, fix logic (#59676)
---
 task-sdk/src/airflow/sdk/api/client.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/task-sdk/src/airflow/sdk/api/client.py 
b/task-sdk/src/airflow/sdk/api/client.py
index 539d07f764a..fece35271f5 100644
--- a/task-sdk/src/airflow/sdk/api/client.py
+++ b/task-sdk/src/airflow/sdk/api/client.py
@@ -914,7 +914,9 @@ class Client(httpx.Client):
     def request(self, *args, **kwargs):
         """Implement a convenience for httpx.Client.request with a retry 
layer."""
         # Set content type as convenience if not already set
-        if "content" in kwargs and "headers" not in kwargs:
+        if kwargs.get("content", None) is not None and "content-type" not in (
+            kwargs.get("headers", {}) or {}
+        ):
             kwargs["headers"] = {"content-type": "application/json"}
 
         return super().request(*args, **kwargs)

Reply via email to