diff options
Diffstat (limited to 'ext/http/service.rs')
-rw-r--r-- | ext/http/service.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/http/service.rs b/ext/http/service.rs index 932575e37..f38fec4f4 100644 --- a/ext/http/service.rs +++ b/ext/http/service.rs @@ -482,12 +482,13 @@ impl HttpRecord { HttpRecordReady(self) } - /// Resolves when response body has finished streaming. - pub fn response_body_finished(&self) -> impl Future<Output = ()> + '_ { + /// Resolves when response body has finished streaming. Returns true if the + /// response completed. + pub fn response_body_finished(&self) -> impl Future<Output = bool> + '_ { struct HttpRecordFinished<'a>(&'a HttpRecord); impl<'a> Future for HttpRecordFinished<'a> { - type Output = (); + type Output = bool; fn poll( self: Pin<&mut Self>, @@ -495,7 +496,10 @@ impl HttpRecord { ) -> Poll<Self::Output> { let mut mut_self = self.0.self_mut(); if mut_self.response_body_finished { - return Poll::Ready(()); + // If we sent the response body and the trailers, this body completed successfully + return Poll::Ready( + mut_self.response_body.is_complete() && mut_self.trailers.is_none(), + ); } mut_self.response_body_waker = Some(cx.waker().clone()); Poll::Pending |