fix: filter out 'host' header

This commit is contained in:
əlemi 2022-10-21 02:22:06 +02:00
parent b2fbac1193
commit 67019e1743
2 changed files with 2 additions and 2 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "http-debugger"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -71,7 +71,7 @@ async fn echo_json(mut req: Request<Body>) -> Result<Response<Body>, hyper::http
path: req.uri().to_string(),
method: req.method().to_string(),
version: format!("{:?}", req.version()),
headers: req.headers().iter().map(|(k, v)| parse_header(k, v)).collect(),
headers: req.headers().iter().map(|(k, v)| parse_header(k, v)).filter(|(k, _v)| k != "host").collect(),
body: String::from_utf8(body::to_bytes(req.body_mut()).await.unwrap().to_vec()).ok(),
time: SystemTime::now().duration_since(UNIX_EPOCH).unwrap_or(Duration::from_secs(0)).as_millis(),
};