Skip to content

Add Content-Type to Request Header in Task SDK calls, fix logic#59676

Merged
jscheffl merged 1 commit intoapache:mainfrom
jscheffl:bugfix/add-content-type-to-task-sdk-calls-v2
Dec 21, 2025
Merged

Add Content-Type to Request Header in Task SDK calls, fix logic#59676
jscheffl merged 1 commit intoapache:mainfrom
jscheffl:bugfix/add-content-type-to-task-sdk-calls-v2

Conversation

@jscheffl
Copy link
Copy Markdown
Contributor

After we deployed Airflow 3.1.5 to our environment @AutomationDev85 and me noticed that still the WAF rules hit the deployment and debugging one level deeper revealed a logic problem of the fix applied in #57377:

The call from base class patch() to the extended Client from TaskSDK uses actually (empty) kwargs for content and header (e.g. passing content=None and header=None which then made the header not applied. See also https://github.com/encode/httpx/blob/master/httpx/_client.py#L1221

This PR corrects the logic to check for "if any content is to be submitted" and "No header for content type set". With this the content-type header is now consistently applied making our WAF happy.

@jscheffl jscheffl force-pushed the bugfix/add-content-type-to-task-sdk-calls-v2 branch from defacbc to fa712ba Compare December 21, 2025 08:46
@jscheffl jscheffl merged commit 288b09a into apache:main Dec 21, 2025
97 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 21, 2025
… logic (#59676)

(cherry picked from commit 288b09a)

Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Backport successfully created: v3-1-test

Status Branch Result
v3-1-test PR Link

jscheffl added a commit that referenced this pull request Dec 21, 2025
… logic (#59676) (#59687)

(cherry picked from commit 288b09a)

Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Jan 2, 2026
ephraimbuddy pushed a commit that referenced this pull request Jan 6, 2026
… logic (#59676) (#59687)

(cherry picked from commit 288b09a)

Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
stegololz pushed a commit to stegololz/airflow that referenced this pull request Jan 9, 2026
jhgoebbert pushed a commit to jhgoebbert/airflow_Owen-CH-Leung that referenced this pull request Feb 8, 2026
Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants