src/server/rest.rs: use correct formatter

This commit is contained in:
Dietmar Maurer 2020-03-26 12:54:20 +01:00
parent 3383973532
commit 4299ca727c
1 changed files with 9 additions and 3 deletions

View File

@ -550,13 +550,19 @@ pub async fn handle_request(api: Arc<ApiConfig>, req: Request<Body>) -> Result<R
return Ok((formatter.format_error)(err)); return Ok((formatter.format_error)(err));
} }
Some(api_method) => { Some(api_method) => {
if api_method.protected && env_type == RpcEnvironmentType::PUBLIC { let result = if api_method.protected && env_type == RpcEnvironmentType::PUBLIC {
return proxy_protected_request(api_method, parts, body).await; proxy_protected_request(api_method, parts, body).await
} else { } else {
return handle_api_request(rpcenv, api_method, formatter, parts, body, uri_param).await; handle_api_request(rpcenv, api_method, formatter, parts, body, uri_param).await
} };
if let Err(err) = result {
return Ok((formatter.format_error)(err));
}
return result;
} }
} }
} }
} else { } else {
// not Auth required for accessing files! // not Auth required for accessing files!