You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2025/10/27 23:01:03 UTC

(airflow) branch v3-1-test updated: [v3-1-test] Add Content-Type to Request Header in Task SDK calls (#57377) (#57386)

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

potiuk 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 fe7f73c34b3 [v3-1-test] Add Content-Type to Request Header in Task SDK calls (#57377) (#57386)
fe7f73c34b3 is described below

commit fe7f73c34b39878f0db0fd607c7f2feb95fefff3
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Tue Oct 28 00:00:56 2025 +0100

    [v3-1-test] Add Content-Type to Request Header in Task SDK calls (#57377) (#57386)
    
    (cherry picked from commit 8695fc533d5efd07952a670cafbb0f120639d0ba)
    
    Co-authored-by: Jens Scheffler <95...@users.noreply.github.com>
---
 task-sdk/src/airflow/sdk/api/client.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/task-sdk/src/airflow/sdk/api/client.py b/task-sdk/src/airflow/sdk/api/client.py
index 6d71a7f106b..6c1134036d3 100644
--- a/task-sdk/src/airflow/sdk/api/client.py
+++ b/task-sdk/src/airflow/sdk/api/client.py
@@ -863,6 +863,10 @@ 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:
+            kwargs["headers"] = {"content-type": "application/json"}
+
         return super().request(*args, **kwargs)
 
     # We "group" or "namespace" operations by what they operate on, rather than a flat namespace with all