server/rest.rs: simplify proxy code
Only pass neccessary parameters.
This commit is contained in:
parent
a859fa95a9
commit
c8f3f9b1af
|
@ -158,13 +158,9 @@ fn get_request_parameters_async(
|
||||||
Box::new(resp)
|
Box::new(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn proxy_sync_api_request(
|
fn proxy_protected_request(
|
||||||
rpcenv: RestEnvironment,
|
|
||||||
info: &'static ApiMethod,
|
|
||||||
formatter: &'static OutputFormatter,
|
|
||||||
mut parts: Parts,
|
mut parts: Parts,
|
||||||
req_body: Body,
|
req_body: Body,
|
||||||
uri_param: HashMap<String, String>,
|
|
||||||
) -> BoxFut
|
) -> BoxFut
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -448,7 +444,7 @@ pub fn handle_request(api: Arc<ApiConfig>, req: Request<Body>) -> BoxFut {
|
||||||
MethodDefinition::None => {}
|
MethodDefinition::None => {}
|
||||||
MethodDefinition::Simple(api_method) => {
|
MethodDefinition::Simple(api_method) => {
|
||||||
if api_method.protected && env_type == RpcEnvironmentType::PUBLIC {
|
if api_method.protected && env_type == RpcEnvironmentType::PUBLIC {
|
||||||
return proxy_sync_api_request(rpcenv, api_method, formatter, parts, body, uri_param);
|
return proxy_protected_request(parts, body);
|
||||||
} else {
|
} else {
|
||||||
return handle_sync_api_request(rpcenv, api_method, formatter, parts, body, uri_param);
|
return handle_sync_api_request(rpcenv, api_method, formatter, parts, body, uri_param);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue