diff --git a/src/client/conn/http1.rs b/src/client/conn/http1.rs index fb9a41da25..72cdcdc83e 100644 --- a/src/client/conn/http1.rs +++ b/src/client/conn/http1.rs @@ -88,6 +88,16 @@ where pub fn poll_without_shutdown(&mut self, cx: &mut Context<'_>) -> Poll> { self.inner.poll_without_shutdown(cx) } + + /// Prevent shutdown of the underlying IO object at the end of service the request, + /// instead run `into_parts`. This is a convenience wrapper over `poll_without_shutdown`. + pub fn without_shutdown(self) -> impl Future>> { + let mut conn = Some(self); + future::poll_fn(move |cx| -> Poll>> { + ready!(conn.as_mut().unwrap().poll_without_shutdown(cx))?; + Poll::Ready(Ok(conn.take().unwrap().into_parts())) + }) + } } /// A builder to configure an HTTP connection.