1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pub mod body_chunk;
pub mod errors;
pub mod form;
pub mod multipart;
pub mod range;
pub mod request;
pub mod response;
pub use body_chunk::BodyChunk;
pub use cookie;
pub use http::method::Method;
pub use http::{HeaderMap, HeaderValue, StatusCode};
pub use mime::Mime;
pub use range::HttpRange;
pub use request::Request;
pub use response::Response;
pub use errors::{HttpError, ReadError};
pub use http::header;
pub use headers;
pub fn guess_accept_mime(req: &Request, default_type: Option<Mime>) -> Mime {
let dmime: Mime = default_type.unwrap_or_else(|| "text/html".parse().unwrap());
let accept = req.accept();
accept.first().unwrap_or(&dmime).to_string().parse().unwrap_or(dmime)
}