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
41
42
43
44
use chrono::Utc;
use warp::{Reply, fs::File, http::HeaderValue, hyper::{Body, HeaderMap, Response}};
pub fn add_headers(reply: File)->Response<Body> {
let mut res = reply.into_response();
let headers = res.headers_mut();
let header_map = create_headers();
headers.extend(header_map);
res
}
fn create_headers() -> HeaderMap {
let mut header_map = HeaderMap::new();
let now = Utc::now();
let now_str = now.format("%a, %d %h %Y %T GMT").to_string();
header_map.insert("Expires", HeaderValue::from_str(now_str.as_str()).unwrap());
header_map.insert("Server", HeaderValue::from_str("webview-app").unwrap());
header_map
}