Skip to content

Commit

Permalink
Flush body writers after they are terminated
Browse files Browse the repository at this point in the history
  • Loading branch information
rmja committed Jul 2, 2024
1 parent 51d1b46 commit 69f0591
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,19 +313,22 @@ where
let mut writer = ChunkedBodyWriter::new(c);
body.write(&mut writer).await?;
writer.terminate().await.map_err(|e| e.kind())?;
writer.flush().await?;
}
HttpConnection::PlainBuffered(buffered) => {
let (conn, buf, unwritten) = buffered.split();
let mut writer = BufferingChunkedBodyWriter::new_with_data(conn, buf, unwritten);
body.write(&mut writer).await?;
writer.terminate().await.map_err(|e| e.kind())?;
writer.flush().await?;
buffered.clear();
}
#[cfg(any(feature = "embedded-tls", feature = "esp-mbedtls"))]
HttpConnection::Tls(c) => {
let mut writer = ChunkedBodyWriter::new(c);
body.write(&mut writer).await?;
writer.terminate().await.map_err(|e| e.kind())?;
writer.flush().await?;
}
#[cfg(all(not(feature = "embedded-tls"), not(feature = "esp-mbedtls")))]
HttpConnection::Tls(_) => unreachable!(),
Expand Down

0 comments on commit 69f0591

Please sign in to comment.