mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
update tests to async handlers
This commit is contained in:
@ -388,6 +388,12 @@ impl BoxedResponseHead {
|
||||
pub fn new(status: StatusCode) -> Self {
|
||||
RESPONSE_POOL.with(|p| p.get_message(status))
|
||||
}
|
||||
|
||||
pub(crate) fn take(&mut self) -> Self {
|
||||
BoxedResponseHead {
|
||||
head: self.head.take(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for BoxedResponseHead {
|
||||
@ -406,7 +412,9 @@ impl std::ops::DerefMut for BoxedResponseHead {
|
||||
|
||||
impl Drop for BoxedResponseHead {
|
||||
fn drop(&mut self) {
|
||||
RESPONSE_POOL.with(|p| p.release(self.head.take().unwrap()))
|
||||
if let Some(head) = self.head.take() {
|
||||
RESPONSE_POOL.with(move |p| p.release(head))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,10 +288,7 @@ impl Future for Response {
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, _: &mut Context) -> Poll<Self::Output> {
|
||||
Poll::Ready(Ok(Response {
|
||||
head: std::mem::replace(
|
||||
&mut self.head,
|
||||
BoxedResponseHead::new(StatusCode::OK),
|
||||
),
|
||||
head: self.head.take(),
|
||||
body: self.body.take_body(),
|
||||
error: self.error.take(),
|
||||
}))
|
||||
|
Reference in New Issue
Block a user