Skip to content

Preserve DELETE request bodies in HttpAsyncHook - #72720

Merged
potiuk merged 1 commit into
apache:mainfrom
jakezwang:fix-http-async-delete-data
Sep 20, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
jakezwang:fix-http-async-delete-data

Conversation

@jakezwang

@jakezwang jakezwang commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

HttpAsyncHook silently drops data supplied to DELETE requests. Forward the request body to aiohttp, matching the synchronous HttpHook behavior. Add regression coverage for string and form payloads with both hook-managed and externally supplied sessions.

Validation in a scoped Breeze environment: 134 HTTP provider tests passed (one version-specific skip), mypy passed for all 29 HTTP-provider files, and provider metadata validation passed. All four regressions fail without the fix. Ruff and applicable fast/manual checks passed; the all-provider mypy sweep and broader CI matrix remain pending.


Was generative AI tooling used to co-author this PR?
  • Yes (OpenAI Codex, gpt-6-astra)

Generated-by: OpenAI Codex (gpt-6-astra) following the guidelines

@boring-cyborg

boring-cyborg Bot commented Sep 8, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@jakezwang
jakezwang force-pushed the fix-http-async-delete-data branch from 3b94308 to 354c194 Compare September 9, 2026 19:21

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is correct and minimal: AsyncHttpSession.run() now forwards data for DELETE just like the sync HttpHook.run() already does, and as providers/http/docs/operators.rst documents for its own DELETE example ("passing form data to the request"). _get_request_func already mapped DELETE to session.delete, so the body forward was the only thing missing.

The new parametrized test genuinely fails without the change, and specs its mock with spec=aiohttp.ClientSession.delete — stricter than the surrounding tests in that class. Thanks for that.

Smaller observations

  • The use_external_session parametrization exercises the pre-existing session dispatch in HttpAsyncHook.run(); both branches reach the same changed line through AsyncHttpSession.run(), so it doubles the cases without adding coverage of the fix. Cheap and harmless, so keeping it is fine.
  • Not for this PR: after this change the async set is {"POST", "PUT", "PATCH", "DELETE"}, while the sync hook forwards data for every method except GET and HEAD. So OPTIONS, which _get_request_func does support, still drops its body in the async path. Mirroring the sync condition would remove the last asymmetry.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Airflow handles maintainer review:
contributing-docs/05_pull_requests.rst.

@potiuk
potiuk merged commit 9ccb991 into apache:main Sep 20, 2026
83 checks passed
@boring-cyborg

boring-cyborg Bot commented Sep 20, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

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