fix: do not cache non-Bytes
so docs & errors don't get cached
This commit is contained in:
parent
9b20403cef
commit
a3383084fb
1 changed files with 2 additions and 2 deletions
|
@ -51,7 +51,6 @@ fn send_response(mut stream: TcpStream, status: u16, body: Body) -> UnitOrBoxedE
|
|||
|
||||
// Headers
|
||||
response.push_str("Server: luciders\r\n");
|
||||
response.push_str("Cache-Control: immutable, public, max-age=604800\r\n");
|
||||
// CORS
|
||||
response.push_str("Access-Control-Allow-Origin: *\r\n");
|
||||
response.push_str("Access-Control-Allow-Methods: GET\r\n");
|
||||
|
@ -65,7 +64,8 @@ fn send_response(mut stream: TcpStream, status: u16, body: Body) -> UnitOrBoxedE
|
|||
));
|
||||
match &body {
|
||||
Body::Bytes(_, content_type) => {
|
||||
response.push_str(&format!("Content-Type: {}\r\n", content_type))
|
||||
response.push_str(&format!("Content-Type: {}\r\n", content_type));
|
||||
response.push_str("Cache-Control: immutable, public, max-age=604800\r\n");
|
||||
}
|
||||
Body::Static(_) => response.push_str("Content-Type: text/plain; charset=utf-8\r\n"),
|
||||
_ => {}
|
||||
|
|
Loading…
Reference in a new issue