Browse Source

feat: add some headers to res

pull/8/head
sigoden 3 years ago
parent
commit
b88381167b
  1. 4
      src/server.rs

4
src/server.rs

@ -8,7 +8,7 @@ use futures::stream::StreamExt;
use futures::TryStreamExt; use futures::TryStreamExt;
use headers::{ use headers::{
AccessControlAllowHeaders, AccessControlAllowOrigin, ContentRange, ContentType, ETag, AccessControlAllowHeaders, AccessControlAllowOrigin, ContentRange, ContentType, ETag,
HeaderMap, HeaderMapExt, IfModifiedSince, IfNoneMatch, IfRange, LastModified, Range, HeaderMap, HeaderMapExt, IfModifiedSince, IfNoneMatch, IfRange, LastModified, Range, ContentLength, AcceptRanges,
}; };
use hyper::header::{ use hyper::header::{
HeaderValue, ACCEPT, AUTHORIZATION, CONTENT_DISPOSITION, CONTENT_TYPE, ORIGIN, RANGE, HeaderValue, ACCEPT, AUTHORIZATION, CONTENT_DISPOSITION, CONTENT_TYPE, ORIGIN, RANGE,
@ -366,6 +366,8 @@ impl InnerService {
Body::wrap_stream(stream) Body::wrap_stream(stream)
}; };
*res.body_mut() = body; *res.body_mut() = body;
res.headers_mut().typed_insert(AcceptRanges::bytes());
res.headers_mut().typed_insert(ContentLength(meta.len() as u64));
Ok(()) Ok(())
} }

Loading…
Cancel
Save