❇️ content-length response header
parent
4c03e6d32a
commit
9e3470d5b4
|
@ -122,6 +122,8 @@ async fn main () -> Result <(), Box <dyn Error>> {
|
||||||
f.seek (SeekFrom::Start (start)).await.unwrap ();
|
f.seek (SeekFrom::Start (start)).await.unwrap ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let file_md = f.metadata ().await.unwrap ();
|
||||||
|
|
||||||
tokio::spawn (async move {
|
tokio::spawn (async move {
|
||||||
//println! ("Opening file {:?}", path);
|
//println! ("Opening file {:?}", path);
|
||||||
|
|
||||||
|
@ -150,7 +152,11 @@ async fn main () -> Result <(), Box <dyn Error>> {
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut headers: HashMap <String, Vec <u8>> = Default::default ();
|
let mut headers: HashMap <String, Vec <u8>> = Default::default ();
|
||||||
headers.insert (String::from ("x-its-a-header"), Vec::from (&b"wow"[..]));
|
//headers.insert (String::from ("x-its-a-header"), Vec::from (&b"wow"[..]));
|
||||||
|
|
||||||
|
if range_start.is_none () && range_end.is_none () {
|
||||||
|
headers.insert (String::from ("content-length"), file_md.len ().to_string ().into_bytes ());
|
||||||
|
}
|
||||||
|
|
||||||
let resp_parts = http_serde::ResponseParts {
|
let resp_parts = http_serde::ResponseParts {
|
||||||
status_code: http_serde::StatusCode::Ok,
|
status_code: http_serde::StatusCode::Ok,
|
||||||
|
|
Loading…
Reference in New Issue