From f16aea687aa2c2f95a7ac4fa996149d0a37edca2 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 28 Sep 2019 18:22:48 +0200 Subject: [PATCH] src/client/http_client.rs: new helper send_upload_request() --- src/client/http_client.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/client/http_client.rs b/src/client/http_client.rs index 0ab92e3e..8c36a7cd 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -611,6 +611,20 @@ impl BackupClient { self.h2.upload("POST", path, param, content_type, data).await } + pub async fn send_upload_request( + &self, + method: &str, + path: &str, + param: Option, + content_type: &str, + data: Vec, + ) -> Result { + + let request = H2Client::request_builder("localhost", method, path, param, Some(content_type)).unwrap(); + let response_future = self.h2.send_request(request, Some(bytes::Bytes::from(data.clone()))).await?; + Ok(response_future) + } + pub async fn upload_put( &self, path: &str, @@ -1187,7 +1201,7 @@ impl H2Client { }) } - async fn h2api_response( + pub async fn h2api_response( response: Response, ) -> Result { let status = response.status();