Skip to content

Commit

Permalink
change client sender api
Browse files Browse the repository at this point in the history
  • Loading branch information
yayanyang committed Mar 15, 2024
1 parent 95a7bdb commit fcc175d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions crates/ext/src/net/http/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl AsyncRead for HttpClientRead {
pub trait HttpRequestSend {
type Body;

fn send(self) -> HttpRequestSender<Self::Body>;
fn sender(self) -> HttpRequestSender<Self::Body>;
}

/// A builder to create a task to send http request.
Expand Down Expand Up @@ -210,7 +210,7 @@ impl<T> HttpRequestSender<T> {
}

/// Start a new
pub async fn response(self) -> io::Result<Response<BodyReader<HttpClientRead>>>
pub async fn send(self) -> io::Result<Response<BodyReader<HttpClientRead>>>
where
T: AsRef<[u8]>,
{
Expand Down Expand Up @@ -243,7 +243,7 @@ impl<T> HttpRequestSender<T> {
}
}

pub async fn stream_response(self) -> io::Result<Response<BodyReader<HttpClientRead>>>
pub async fn send_with_stream_body(self) -> io::Result<Response<BodyReader<HttpClientRead>>>
where
T: AsyncRead + Unpin,
{
Expand Down Expand Up @@ -287,7 +287,7 @@ where
{
type Body = T;

fn send(self) -> HttpRequestSender<Self::Body> {
fn sender(self) -> HttpRequestSender<Self::Body> {
HttpRequestSender::new(self)
}
}
6 changes: 3 additions & 3 deletions crates/ext/tests/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ async fn test_http() {

let response = Request::get(format!("http://{:?}/hello", raddr))
.body("")
.sender()
.send()
.response()
.await
.unwrap();

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit fcc175d

Please sign in to comment.