mirror of https://github.com/fafhrd91/actix-web
use more efficient string conversion
This commit is contained in:
parent
28ed10ef0a
commit
65ca23ec56
|
@ -46,7 +46,7 @@ impl FrozenClientRequest {
|
||||||
/// Send a body.
|
/// Send a body.
|
||||||
pub fn send_body<B>(&self, body: B) -> SendClientRequest
|
pub fn send_body<B>(&self, body: B) -> SendClientRequest
|
||||||
where
|
where
|
||||||
B: actix_http::body::MessageBody + 'static,
|
B: MessageBody + 'static,
|
||||||
{
|
{
|
||||||
RequestSender::Rc(self.head.clone(), None).send_body(
|
RequestSender::Rc(self.head.clone(), None).send_body(
|
||||||
self.addr,
|
self.addr,
|
||||||
|
|
|
@ -191,6 +191,7 @@ where
|
||||||
// try to reuse body
|
// try to reuse body
|
||||||
match body {
|
match body {
|
||||||
Some(ref bytes) => AnyBody::from(bytes.clone()),
|
Some(ref bytes) => AnyBody::from(bytes.clone()),
|
||||||
|
// TODO: should this be AnyBody::Empty or AnyBody::None.
|
||||||
_ => AnyBody::empty(),
|
_ => AnyBody::empty(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -231,7 +231,7 @@ impl RequestSender {
|
||||||
response_decompress,
|
response_decompress,
|
||||||
timeout,
|
timeout,
|
||||||
config,
|
config,
|
||||||
AnyBody::copy_from_slice(body.as_bytes()),
|
AnyBody::from_message_body(body.into_bytes()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ impl RequestSender {
|
||||||
response_decompress,
|
response_decompress,
|
||||||
timeout,
|
timeout,
|
||||||
config,
|
config,
|
||||||
AnyBody::copy_from_slice(body.as_bytes()),
|
AnyBody::from_message_body(body.into_bytes()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue