diff --git a/src/client/body/stream.rs b/src/client/body/stream.rs index 9908c53c..f6d823f3 100644 --- a/src/client/body/stream.rs +++ b/src/client/body/stream.rs @@ -334,6 +334,11 @@ impl Stream for PyAsyncStream { let this = self.get_mut(); match this.rx.poll_recv(cx) { Poll::Ready(Some(Some(item))) => Poll::Ready(Some(item)), + Poll::Ready(Some(None)) => { + this.rx.close(); + this.task.take(); + Poll::Ready(None) + } Poll::Ready(_) => { this.rx.close(); Poll::Ready(None)