Skip to content

Commit

Permalink
add convert from NoneBody to RequestBody.
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeshadow committed Jan 15, 2024
1 parent fae1cd5 commit 75cd02c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion http/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ impl Stream for RequestBody {
}
}

impl<B> From<NoneBody<B>> for RequestBody {
fn from(_: NoneBody<B>) -> Self {
Self::None
}
}

impl From<Bytes> for RequestBody {
fn from(bytes: Bytes) -> Self {
Self::from(Once::new(bytes))
Expand Down Expand Up @@ -430,7 +436,7 @@ res_bytes_impl!(String);

impl<B> From<Box<str>> for ResponseBody<B> {
fn from(str: Box<str>) -> Self {
Self::from(String::from(str))
Self::from(Box::<[u8]>::from(str))
}
}

Expand Down

0 comments on commit 75cd02c

Please sign in to comment.