Use content-lengh when there is no ranges header

This commit is contained in:
Ivan 2024-07-28 12:15:56 +02:00
parent a77c1caace
commit aa2bac8bf5

View file

@ -206,13 +206,13 @@ impl HttpApi {
)) ))
.context("bug")?, .context("bug")?,
); );
}
} else { } else {
output_headers.insert( output_headers.insert(
http::header::CONTENT_LENGTH, http::header::CONTENT_LENGTH,
HeaderValue::from_str(&format!("{}", stream.len())).context("bug")?, HeaderValue::from_str(&format!("{}", stream.len())).context("bug")?,
); );
} }
}
let s = tokio_util::io::ReaderStream::new(stream); let s = tokio_util::io::ReaderStream::new(stream);
Ok((status, (output_headers, axum::body::Body::from_stream(s)))) Ok((status, (output_headers, axum::body::Body::from_stream(s))))