diff --git a/Cargo.toml b/Cargo.toml index 3c78b04..5183165 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "http-debugger" -version = "0.2.1" +version = "0.2.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 623ff88..275136e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,7 @@ struct InspectRequest { #[serde(serialize_with = "ordered_map")] pub headers: HashMap, pub body: Option, - pub time: u128, + pub time: f64, } async fn echo_json(mut req: Request) -> Result, hyper::http::Error> { @@ -73,7 +73,7 @@ async fn echo_json(mut req: Request) -> Result, hyper::http version: format!("{:?}", req.version()), 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(), + time: SystemTime::now().duration_since(UNIX_EPOCH).unwrap_or(Duration::from_secs(0)).as_secs_f64(), }; let serialized = serde_json::to_string(&inspect).unwrap_or("[]".to_string());