use more efficient string conversion

This commit is contained in:
Rob Ede 2021-12-25 00:41:32 +00:00
parent 28ed10ef0a
commit 65ca23ec56
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 4 additions and 3 deletions

View File

@ -46,7 +46,7 @@ impl FrozenClientRequest {
/// Send a body.
pub fn send_body<B>(&self, body: B) -> SendClientRequest
where
B: actix_http::body::MessageBody + 'static,
B: MessageBody + 'static,
{
RequestSender::Rc(self.head.clone(), None).send_body(
self.addr,

View File

@ -191,6 +191,7 @@ where
// try to reuse body
match body {
Some(ref bytes) => AnyBody::from(bytes.clone()),
// TODO: should this be AnyBody::Empty or AnyBody::None.
_ => AnyBody::empty(),
}
} else {

View File

@ -231,7 +231,7 @@ impl RequestSender {
response_decompress,
timeout,
config,
AnyBody::copy_from_slice(body.as_bytes()),
AnyBody::from_message_body(body.into_bytes()),
)
}
@ -260,7 +260,7 @@ impl RequestSender {
response_decompress,
timeout,
config,
AnyBody::copy_from_slice(body.as_bytes()),
AnyBody::from_message_body(body.into_bytes()),
)
}