Skip to content

Commit

Permalink
Resolve PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths committed Nov 1, 2024
1 parent daa132b commit 7a05449
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let file = fs::File::open(file!()).await?;
let file = FileStreamBuilder::new(file)
// Simulate a slow, chunky request.
.buffer_size(256usize)
.buffer_size(512usize)
.build()
.await?;
client::put_binary_data(file.into()).await?;
Expand All @@ -50,17 +50,17 @@ mod client {

let content = match body {
Body::Bytes(ref bytes) => {
debug!("received bytes");
debug!("received {} bytes", bytes.len());
bytes.to_owned()
}
Body::SeekableStream(mut stream) => {
debug!("received stream");
let stream = stream.as_mut();

let mut bytes = Vec::new();
while let Some(buf) = stream.next().await {
debug!("reading partial request...");
bytes.extend(buf?);
while let Some(Ok(buf)) = stream.next().await {
debug!("read {} bytes from stream", buf.len());
bytes.extend(buf);
}

bytes.into()
Expand Down

0 comments on commit 7a05449

Please sign in to comment.