Skip to content

Commit

Permalink
Merge pull request #65 from ghu/patch-1
Browse files Browse the repository at this point in the history
Fix for incorrect Content-Length: 0 handling
  • Loading branch information
jayjamesjay authored Jun 20, 2024
2 parents 7f50f7f + 8000c69 commit e1f8622
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,10 @@ impl<'a> RequestBuilder<'a> {
let deadline = Instant::now() + timeout;
copy_with_timeout(stream, writer, deadline)?;
} else {
let num_bytes = res.content_len().unwrap_or(0);

if num_bytes > 0 {
copy_exact(stream, writer, num_bytes - body_part.len())?;
if let Some(num_bytes) = res.content_len() {
if num_bytes > 0 {
copy_exact(stream, writer, num_bytes - body_part.len())?;
}
} else {
io::copy(stream, writer)?;
}
Expand Down

0 comments on commit e1f8622

Please sign in to comment.