http compressions stage 1 attempt 3
This commit is contained in:
parent
35001306fb
commit
38ded8a8c3
17
src/main.rs
17
src/main.rs
@ -240,11 +240,18 @@ impl Response {
|
||||
|
||||
fn headers (&self) -> Vec<String> {
|
||||
match self {
|
||||
Self::TextPlain(text, enc) => vec![
|
||||
f!("Content-Type: text/plain"),
|
||||
format!("Content-Length: {}", text.len()),
|
||||
enc.header().to_string(),
|
||||
],
|
||||
Self::TextPlain(text, enc) => {
|
||||
let mut v = vec![
|
||||
f!("Content-Type: text/plain"),
|
||||
format!("Content-Length: {}", text.len()),
|
||||
];
|
||||
|
||||
let enc = enc.header();
|
||||
|
||||
if !enc.is_empty() { v.push(enc.to_string()) }
|
||||
|
||||
v
|
||||
},
|
||||
Self::OctetStream(bytes) => vec![
|
||||
f!("Content-Type: application/octet-stream"),
|
||||
format!("Content-Length: {}", bytes.len())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user