From cfe0867fcf3a35293083561f6af2bd308197b622 Mon Sep 17 00:00:00 2001 From: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> Date: Mon, 27 Oct 2025 23:47:15 +0100 Subject: [PATCH] [v3-1-test] Add Content-Type to Request Header in Task SDK calls (#57377) (cherry picked from commit 8695fc533d5efd07952a670cafbb0f120639d0ba) Co-authored-by: Jens Scheffler <95105677+jscheffl@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 6d71a7f106b9b..6c1134036d364 100644 --- a/task-sdk/src/airflow/sdk/api/client.py +++ b/task-sdk/src/airflow/sdk/api/client.py @@ -863,6 +863,10 @@ def _update_auth(self, response: httpx.Response): ) 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