From fcc175d4dbb3d3468e25b6c6073c746f945e5e61 Mon Sep 17 00:00:00 2001 From: yayanyang Date: Fri, 15 Mar 2024 17:30:11 +0800 Subject: [PATCH] change client sender api --- crates/ext/src/net/http/client.rs | 8 ++++---- crates/ext/tests/http.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ext/src/net/http/client.rs b/crates/ext/src/net/http/client.rs index c2cce94..a3a1825 100644 --- a/crates/ext/src/net/http/client.rs +++ b/crates/ext/src/net/http/client.rs @@ -89,7 +89,7 @@ impl AsyncRead for HttpClientRead { pub trait HttpRequestSend { type Body; - fn send(self) -> HttpRequestSender; + fn sender(self) -> HttpRequestSender; } /// A builder to create a task to send http request. @@ -210,7 +210,7 @@ impl HttpRequestSender { } /// Start a new - pub async fn response(self) -> io::Result>> + pub async fn send(self) -> io::Result>> where T: AsRef<[u8]>, { @@ -243,7 +243,7 @@ impl HttpRequestSender { } } - pub async fn stream_response(self) -> io::Result>> + pub async fn send_with_stream_body(self) -> io::Result>> where T: AsyncRead + Unpin, { @@ -287,7 +287,7 @@ where { type Body = T; - fn send(self) -> HttpRequestSender { + fn sender(self) -> HttpRequestSender { HttpRequestSender::new(self) } } diff --git a/crates/ext/tests/http.rs b/crates/ext/tests/http.rs index 47f627d..dfebf60 100644 --- a/crates/ext/tests/http.rs +++ b/crates/ext/tests/http.rs @@ -36,8 +36,8 @@ async fn test_http() { let response = Request::get(format!("http://{:?}/hello", raddr)) .body("") + .sender() .send() - .response() .await .unwrap(); @@ -95,10 +95,10 @@ async fn test_https() { let response = Request::get(format!("https://rasi.quic/hello")) .body("") - .send() + .sender() .redirect(raddr) .with_ca_file(ca_file) - .response() + .send () .await .unwrap();