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