Skip to content

Commit fa16bed

Browse files
finish connect
1 parent d7c51f1 commit fa16bed

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/client.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ impl Encoder {
4949
}
5050

5151
/// Send an HTTP request over a stream.
52-
pub async fn connect<RW>(stream: RW, req: Request) -> Result<Response, std::io::Error>
52+
pub async fn connect<RW>(mut stream: RW, req: Request) -> Result<Response, Error>
5353
where
54-
RW: Read + Write + Clone + Send + Sync + Unpin + 'static,
54+
RW: Read + Write + Send + Sync + Unpin + 'static,
5555
{
5656
let mut req = encode(req).await?;
57-
io::copy(&mut req, &mut stream.clone()).await?;
58-
let res = decode(stream.clone()).await.unwrap(); // todo: convert to http_types::Error
57+
log::trace!("> {:?}", &req);
58+
59+
io::copy(&mut req, &mut stream).await?;
60+
61+
let res = decode(stream).await?;
62+
log::trace!("< {:?}", &res);
63+
5964
Ok(res)
6065
}
6166

0 commit comments

Comments
 (0)