From 75cd02c85c3d62cc35cdf20c6a06e87dad113e62 Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Tue, 16 Jan 2024 04:14:52 +0800 Subject: [PATCH] add convert from NoneBody to RequestBody. --- http/src/body.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/http/src/body.rs b/http/src/body.rs index 3113a0cc..e0458655 100644 --- a/http/src/body.rs +++ b/http/src/body.rs @@ -71,6 +71,12 @@ impl Stream for RequestBody { } } +impl From> for RequestBody { + fn from(_: NoneBody) -> Self { + Self::None + } +} + impl From for RequestBody { fn from(bytes: Bytes) -> Self { Self::from(Once::new(bytes)) @@ -430,7 +436,7 @@ res_bytes_impl!(String); impl From> for ResponseBody { fn from(str: Box) -> Self { - Self::from(String::from(str)) + Self::from(Box::<[u8]>::from(str)) } }