]> git.proxmox.com Git - proxmox.git/commitdiff
adapt to the new ApiHandler variants
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 12 Apr 2022 14:15:09 +0000 (16:15 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 13 Apr 2022 06:13:40 +0000 (08:13 +0200)
namely 'StreamingSync' and 'StreamingAsync'
in rest-server by using the new formatter function,
and in the debug binary by using 'to_value'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
proxmox-rest-server/src/rest.rs

index 2aadf1ed267ab10cb53b2b50c25837bcce2fe94a..1689ef6e6a06d30fda26721748a9cdd5c9671015 100644 (file)
@@ -445,6 +445,19 @@ pub(crate) async fn handle_api_request<Env: RpcEnvironment, S: 'static + BuildHa
             let params = parse_query_parameters(info.parameters, "", &parts, &uri_param)?;
             (handler)(parts, req_body, params, info, Box::new(rpcenv)).await
         }
+        ApiHandler::StreamingSync(handler) => {
+            let params =
+                get_request_parameters(info.parameters, parts, req_body, uri_param).await?;
+            (handler)(params, info, &mut rpcenv)
+                .and_then(|data| formatter.format_data_streaming(data, &rpcenv))
+        }
+        ApiHandler::StreamingAsync(handler) => {
+            let params =
+                get_request_parameters(info.parameters, parts, req_body, uri_param).await?;
+            (handler)(params, info, &mut rpcenv)
+                .await
+                .and_then(|data| formatter.format_data_streaming(data, &rpcenv))
+        }
         ApiHandler::Sync(handler) => {
             let params =
                 get_request_parameters(info.parameters, parts, req_body, uri_param).await?;