src/server/rest.rs: use formatter to encode errors

This commit is contained in:
Dietmar Maurer 2019-04-01 08:04:12 +02:00
parent 7d4ef127cb
commit 49d123ee3a
1 changed files with 4 additions and 1 deletions

View File

@ -573,7 +573,10 @@ pub fn handle_request(api: Arc<ApiConfig>, req: Request<Body>) -> BoxFut {
}
match api.find_method(&components[2..], method, &mut uri_param) {
MethodDefinition::None => {}
MethodDefinition::None => {
let err = http_err!(NOT_FOUND, "Path not found.".to_string());
return Box::new(future::ok((formatter.format_error)(err)));
}
MethodDefinition::Simple(api_method) => {
if api_method.protected && env_type == RpcEnvironmentType::PUBLIC {
return proxy_protected_request(api_method, parts, body);