feat: add cache header

This commit is contained in:
Compositr 2024-11-02 17:39:23 +11:00
parent b297785dd5
commit d7421324dc

View file

@ -39,9 +39,11 @@ fn send_response(mut stream: TcpStream, status: u16, body: Body) -> UnitOrBoxedE
_ => "500 INTERNAL SERVER ERROR", _ => "500 INTERNAL SERVER ERROR",
}; };
let mut response = format!("HTTP/1.1 {}\r\nServer: luciders/0.1.0\r\n", status_line); let mut response = format!("HTTP/1.1 {}\r\n", status_line);
// Headers // Headers
response.push_str("Server: luciders/0.1.0\r\n");
response.push_str("Cache-Control: immutable, public, max-age=604800\r\n");
response.push_str(&format!( response.push_str(&format!(
"Content-Length: {}\r\n", "Content-Length: {}\r\n",
match &body { match &body {