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

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8dff03038ae Add http_conn_id to HttpOperator and HttpSensor 
template_fields (#72582)
8dff03038ae is described below

commit 8dff03038ae4606b07bf82ff260453f3764c9ba9
Author: ucaeon <[email protected]>
AuthorDate: Fri Sep 25 16:14:20 2026 +0900

    Add http_conn_id to HttpOperator and HttpSensor template_fields (#72582)
---
 providers/http/src/airflow/providers/http/operators/http.py |  2 +-
 providers/http/src/airflow/providers/http/sensors/http.py   |  2 +-
 providers/http/tests/unit/http/operators/test_http.py       | 10 ++++++++++
 providers/http/tests/unit/http/sensors/test_http.py         | 10 ++++++++++
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/providers/http/src/airflow/providers/http/operators/http.py 
b/providers/http/src/airflow/providers/http/operators/http.py
index 20bb8b1da62..65268bc6bc5 100644
--- a/providers/http/src/airflow/providers/http/operators/http.py
+++ b/providers/http/src/airflow/providers/http/operators/http.py
@@ -51,7 +51,7 @@ class HttpOperator(BaseOperator):
         :ref:`howto/deferrable:HttpOperator`
 
     :param http_conn_id: The :ref:`http connection<howto/connection:http>` to 
run
-        the operator against
+        the operator against. (templated)
     :param endpoint: The relative part of the full url. (templated)
     :param method: The HTTP method to use, default = "POST"
     :param data: The data to pass. POST-data in POST/PUT and params
diff --git a/providers/http/src/airflow/providers/http/sensors/http.py 
b/providers/http/src/airflow/providers/http/sensors/http.py
index 5fd6cde0696..2d8c4ac85c6 100644
--- a/providers/http/src/airflow/providers/http/sensors/http.py
+++ b/providers/http/src/airflow/providers/http/sensors/http.py
@@ -61,7 +61,7 @@ class HttpSensor(BaseSensorOperator):
         :ref:`howto/operator:HttpSensor`
 
     :param http_conn_id: The :ref:`http connection<howto/connection:http>` to 
run the
-        sensor against
+        sensor against. (templated)
     :param method: The HTTP request method to use
     :param endpoint: The relative part of the full url
     :param request_params: The parameters to be added to the GET url
diff --git a/providers/http/tests/unit/http/operators/test_http.py 
b/providers/http/tests/unit/http/operators/test_http.py
index beba298385f..49b6bc3b0dd 100644
--- a/providers/http/tests/unit/http/operators/test_http.py
+++ b/providers/http/tests/unit/http/operators/test_http.py
@@ -636,3 +636,13 @@ class TestHttpOperator:
             base.BaseHook, "get_connection", lambda _cid: 
SimpleNamespace(login=None, password=None)
         )
         assert HttpOperator(task_id="test_HTTP_op_3")._resolve_auth_type() is 
None
+
+    def test_http_conn_id_is_templated(self):
+        operator = HttpOperator(
+            task_id="test_HTTP_op",
+            endpoint="/",
+            http_conn_id="{{ conn_id }}",
+        )
+        assert "http_conn_id" in operator.template_fields
+        operator.render_template_fields({"conn_id": "http_staging"})
+        assert operator.http_conn_id == "http_staging"
diff --git a/providers/http/tests/unit/http/sensors/test_http.py 
b/providers/http/tests/unit/http/sensors/test_http.py
index 521760f1aeb..d048adc8802 100644
--- a/providers/http/tests/unit/http/sensors/test_http.py
+++ b/providers/http/tests/unit/http/sensors/test_http.py
@@ -258,6 +258,16 @@ class TestHttpSensor:
         with pytest.raises(AirflowException, match="500:Internal Server 
Error"):
             task.execute(context={})
 
+    def test_http_conn_id_is_templated(self):
+        sensor = HttpSensor(
+            task_id="test_http_sensor",
+            endpoint="/health",
+            http_conn_id="{{ conn_id }}",
+        )
+        assert "http_conn_id" in sensor.template_fields
+        sensor.render_template_fields({"conn_id": "http_staging"})
+        assert sensor.http_conn_id == "http_staging"
+
 
 class FakeSession:
     def __init__(self):

Reply via email to