chore: cleanup

This commit is contained in:
ato 2023-02-21 22:05:12 +01:00
parent 1c917722a6
commit d55c8b1164

View File

@ -38,8 +38,7 @@ impl Service<Request<Body>> for Svc {
let addr = self.1.clone();
let router = self.2.clone();
Box::pin(async move {
let uri = parts.uri.path().to_string();
let lua_handle_match = match router.at(uri.as_str()) {
let lua_handle_match = match router.at(parts.uri.path()) {
Ok(res) => res,
Err(_) => {
return Ok(Response::builder()
@ -85,21 +84,16 @@ impl Service<Request<Body>> for Svc {
let mut multipart = Multipart::with_body(Cursor::new(body_bytes), boundary);
multipart
.foreach_entry(|mut arg| {
let mut buf = String::new();
let mut content = String::new();
let name = arg.headers.name;
arg.data.read_to_string(&mut buf).unwrap();
arg.data.read_to_string(&mut content).unwrap();
match arg.headers.filename {
Some(filename) => {
parts_map.insert(
name.to_string(),
Part {
filename,
content: buf,
},
);
parts_map
.insert(name.to_string(), Part { filename, content });
}
None => {
form_map.insert(name.to_string(), buf);
form_map.insert(name.to_string(), content);
}
};
()