This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new 6645d5935cc [v3-1-test] Add Content-Type to Request Header in Task SDK
calls, fix logic (#59676) (#59687)
6645d5935cc is described below
commit 6645d5935ccbd8125836be93397d42585501acd6
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Dec 21 15:44:18 2025 +0100
[v3-1-test] Add Content-Type to Request Header in Task SDK calls, fix logic
(#59676) (#59687)
(cherry picked from commit 288b09a5c446f7bcf63c14c6c72b66f76116621f)
Co-authored-by: Jens Scheffler <[email protected]>
---
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 96174734062..2ef50a72ff7 100644
--- a/task-sdk/src/airflow/sdk/api/client.py
+++ b/task-sdk/src/airflow/sdk/api/client.py
@@ -879,7 +879,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)