src/server/rest.rs: simplify code

This commit is contained in:
Dietmar Maurer
2019-11-22 18:44:14 +01:00
parent 2bbd835b9b
commit 70fbac84da
2 changed files with 54 additions and 101 deletions

View File

@ -7,7 +7,7 @@ use std::task::{Context, Poll};
use futures::*;
use hyper::{Body, Request, Response, StatusCode};
use proxmox::api::{http_err, ApiFuture, ApiHandler, HttpError, Router, RpcEnvironment};
use proxmox::api::{http_err, ApiFuture, HttpError, Router, RpcEnvironment};
use crate::tools;
use crate::server::formatter::*;
@ -58,16 +58,8 @@ impl <E: RpcEnvironment + Clone> H2Service<E> {
future::ok((formatter.format_error)(err)).boxed()
}
Some(api_method) => {
match api_method.handler {
ApiHandler::Sync(_) => {
crate::server::rest::handle_sync_api_request(
self.rpcenv.clone(), api_method, formatter, parts, body, uri_param).boxed()
}
ApiHandler::Async(_) => {
crate::server::rest::handle_async_api_request(
self.rpcenv.clone(), api_method, formatter, parts, body, uri_param).boxed()
}
}
crate::server::rest::handle_api_request(
self.rpcenv.clone(), api_method, formatter, parts, body, uri_param).boxed()
}
}
}