diff --git a/core/src/raw/http_util/body.rs b/core/src/raw/http_util/body.rs index 38f509c60634..ac0174090db8 100644 --- a/core/src/raw/http_util/body.rs +++ b/core/src/raw/http_util/body.rs @@ -164,15 +164,6 @@ impl IncomingAsyncBody { } impl oio::Read for IncomingAsyncBody { - async fn seek(&mut self, pos: io::SeekFrom) -> Result { - let _ = pos; - - Err(Error::new( - ErrorKind::Unsupported, - "output reader doesn't support seeking", - )) - } - async fn read(&mut self, size: usize) -> Result { if self.size == Some(0) { return Ok(Bytes::new()); @@ -191,7 +182,18 @@ impl oio::Read for IncomingAsyncBody { }; } - let bs = self.chunk.split_to(min(size, self.chunk.len())); + let size = min(size, self.chunk.len()); + self.consumed += size as u64; + let bs = self.chunk.split_to(size); Ok(bs) } + + async fn seek(&mut self, pos: io::SeekFrom) -> Result { + let _ = pos; + + Err(Error::new( + ErrorKind::Unsupported, + "output reader doesn't support seeking", + )) + } }