diff --git a/src/server/formatter.rs b/src/server/formatter.rs index 92e6c45f..e49aac14 100644 --- a/src/server/formatter.rs +++ b/src/server/formatter.rs @@ -11,7 +11,7 @@ pub struct ErrorMessageExtension(pub String); pub struct OutputFormatter { - pub format_result: fn(data: Value, rpcenv: &RpcEnvironment) -> Response, + pub format_data: fn(data: Value, rpcenv: &RpcEnvironment) -> Response, pub format_error: fn(err: Error) -> Response, } @@ -33,7 +33,7 @@ pub fn json_response(result: Value) -> Response { response } -fn json_format_result(data: Value, rpcenv: &RpcEnvironment) -> Response { +fn json_format_data(data: Value, rpcenv: &RpcEnvironment) -> Response { let mut result = json!({ "data": data @@ -72,11 +72,11 @@ pub fn json_format_error(err: Error) -> Response { } pub static JSON_FORMATTER: OutputFormatter = OutputFormatter { - format_result: json_format_result, + format_data: json_format_data, format_error: json_format_error, }; -fn extjs_format_result(data: Value, rpcenv: &RpcEnvironment) -> Response { +fn extjs_format_data(data: Value, rpcenv: &RpcEnvironment) -> Response { let mut result = json!({ "data": data, @@ -116,6 +116,6 @@ fn extjs_format_error(err: Error) -> Response { } pub static EXTJS_FORMATTER: OutputFormatter = OutputFormatter { - format_result: extjs_format_result, + format_data: extjs_format_data, format_error: extjs_format_error, }; diff --git a/src/server/rest.rs b/src/server/rest.rs index 9a9d48b1..84611628 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -240,7 +240,7 @@ pub fn handle_sync_api_request( .and_then(move |params| { let mut delay = false; let resp = match (info.handler.as_ref().unwrap())(params, info, &mut rpcenv) { - Ok(data) => (formatter.format_result)(data, &rpcenv), + Ok(data) => (formatter.format_data)(data, &rpcenv), Err(err) => { if let Some(httperr) = err.downcast_ref::() { if httperr.code == StatusCode::UNAUTHORIZED { delay = true; }