Skip to content

fix HttpAsyncHook PUTs with application/json #35404

@andrew9691

Description

@andrew9691

Apache Airflow version

Other Airflow 2 version (please specify below)

What happened

HttpAsyncHook with method='PUT' and data is not supported. As far as I understood PUT is not in the list of available methods for passing kwarg json=data

What you think should happen instead

No response

How to reproduce

generate some PUT async hook runs with some data and await them:

http_async_hook = HttpAsyncHook(method='PUT', http_conn_id='some_conn_id')
hook_run_1 = http_async_hook.run(
    endpoint=f'/some/endpoint/{some_data_1["id"]}',
    data=some_data_1
)
hook_run_2 = http_async_hook.run(
    endpoint=f'/some/endpoint/{some_data_2["id"]}',
    data=some_data_2
)
tasks = [hook_run_1, hook_run_2]
responses = await asyncio.gather(*tasks)

Operating System

NAME="Linux Mint" VERSION="21.2 (Victoria)" ID_LIKE="ubuntu debian"VERSION_ID="21.2" UBUNTU_CODENAME=jammy

Versions of Apache Airflow Providers

apache-airflow==2.7.0
apache-airflow-providers-http==4.6.0

Deployment

Docker-Compose

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions