Skip to content

Commit

Permalink
chore: improve handle_request func
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Liu <[email protected]>
  • Loading branch information
apepkuss committed Sep 26, 2024
1 parent 28a468c commit a74c8f0
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,10 @@ async fn handle_request(
let path = req.uri().path().to_string();
let version = format!("{:?}", req.version());
if req.method() == hyper::http::Method::POST {
let size: u64 = req
.headers()
.get("content-length")
.unwrap()
.to_str()
.unwrap()
.parse()
.unwrap();
let size: u64 = match req.headers().get("content-length") {
Some(content_length) => content_length.to_str().unwrap().parse().unwrap(),
None => 0,
};

info!(target: "stdout", "method: {}, http_version: {}, content-length: {}", method, version, size);
info!(target: "stdout", "endpoint: {}", path);
Expand Down

0 comments on commit a74c8f0

Please sign in to comment.