server/rest: code cleanup: use async
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
dd76eba73e
commit
07995a3ca3
|
@ -140,9 +140,10 @@ impl tower_service::Service<Request<Body>> for ApiService {
|
||||||
let path = req.uri().path().to_owned();
|
let path = req.uri().path().to_owned();
|
||||||
let method = req.method().clone();
|
let method = req.method().clone();
|
||||||
|
|
||||||
|
let config = Arc::clone(&self.api_config);
|
||||||
let peer = self.peer;
|
let peer = self.peer;
|
||||||
handle_request(self.api_config.clone(), req)
|
async move {
|
||||||
.map(move |result| match result {
|
match handle_request(config, req).await {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
log_response(&peer, method, &path, &res);
|
log_response(&peer, method, &path, &res);
|
||||||
Ok::<_, Self::Error>(res)
|
Ok::<_, Self::Error>(res)
|
||||||
|
@ -160,7 +161,8 @@ impl tower_service::Service<Request<Body>> for ApiService {
|
||||||
Ok(resp)
|
Ok(resp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
}
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue