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

shahar1 pushed a commit to branch airflow-ctl/v0-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/airflow-ctl/v0-1-test by this 
push:
     new 52d261ca674 [airflow-ctl/v0-1-test] Require a request body on the 
asset materialize endpoint (#73328) (#76070)
52d261ca674 is described below

commit 52d261ca674f4ade6ebe0504ea73f2a6e3782bff
Author: Shahar Epstein <[email protected]>
AuthorDate: Fri Oct 30 19:21:25 2026 +0200

    [airflow-ctl/v0-1-test] Require a request body on the asset materialize 
endpoint (#73328) (#76070)
    
    * Require a request body on the asset materialize endpoint
    
    The materialize endpoint accepted a bodyless POST and applied defaults, 
unlike the other mutating endpoints -- including its sibling trigger-run route 
-- which require an explicit JSON body. Requiring one here makes the contract 
consistent and unambiguous, and updates the in-tree UI and airflowctl clients 
accordingly.
    
    * Add release note for the required materialize request body
    
    Only the airflowctl json={} on assets materialize is backported. The 
airflow-core change that requires the body ships with core 3.4; sending an 
empty JSON body is also accepted by 3.2 and 3.3 servers.
    
    (cherry picked from commit 9fbec0321e5dea498256f0fe56272f7c0dff6a3a)
    
    Co-authored-by: Pierre Jeambrun <[email protected]>
---
 airflow-ctl/src/airflowctl/api/operations.py         | 2 +-
 airflow-ctl/tests/airflow_ctl/api/test_operations.py | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/airflow-ctl/src/airflowctl/api/operations.py 
b/airflow-ctl/src/airflowctl/api/operations.py
index 33e3807e4aa..b7149d4b91f 100644
--- a/airflow-ctl/src/airflowctl/api/operations.py
+++ b/airflow-ctl/src/airflowctl/api/operations.py
@@ -306,7 +306,7 @@ class AssetsOperations(BaseOperations):
 
     def materialize(self, asset_id: str) -> DAGRunResponse | 
ServerResponseError:
         """Materialize an asset."""
-        self.response = self.client.post(f"assets/{asset_id}/materialize")
+        self.response = self.client.post(f"assets/{asset_id}/materialize", 
json={})
         return DAGRunResponse.model_validate_json(self.response.content)
 
     def get_queued_events(self, asset_id: str) -> 
QueuedEventCollectionResponse | ServerResponseError:
diff --git a/airflow-ctl/tests/airflow_ctl/api/test_operations.py 
b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
index e1848c26509..76262b2c38e 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_operations.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
@@ -490,6 +490,8 @@ class TestAssetsOperations:
     def test_materialize(self):
         def handle_request(request: httpx.Request) -> httpx.Response:
             assert request.url.path == 
f"/api/v2/assets/{self.asset_id}/materialize"
+            # The endpoint requires a request body, so the client must send 
one.
+            assert json.loads(request.content) == {}
             return httpx.Response(200, 
json=json.loads(self.dag_run_response.model_dump_json()))
 
         client = make_api_client(transport=httpx.MockTransport(handle_request))

Reply via email to